Use Google Tag Manager

If you are following this Google Tag Manager integration process, you should already have followed the React Native Firebase setup. We will assume that you are using the officially supported Firebase bridge the officially supported Firebase bridge. We will also assume that you have added the native GTM library to your iOS and Android project (following the iOS documentation and the Android documentation).

Before anything, you also need to integrate the Contentsquare Bridge (see section: Add Contentsquare to your app).

The whole integration will happen in the native part of your app, as well as in the GTM interface. Here is how it will work (note that you need to do these steps twice, once for iOS and once for Android):

  • You will first setup custom tag, trigger and variables in your GTM interface.
  • Then, you will have to add a custom Tag class in your native project.
  • In your JavaScript/TypeScript code, or in your native code, you will use the Firebase Analytics library to send events, as explained thereafter.
  • As you have created a trigger for that specific type of event, it will trigger the code in your native custom Tag class, where you will be calling the native SDK function corresponding to that event, thus allowing Contentsquare to collect those events.

Screenview events will be triggered in the Firebase React Native bridge by calling setCurrentScreen.

As the integration is exactly the same as the native ones, you can refer directly to the SDKs’ explanation of the iOS integration and Android integration. You will have to do both in order to have a similar behavior across both platforms.

Transaction events will be triggered in the Firebase React Native bridge by calling logEcommercePurchase.

As the integration is exactly the same as the native ones, you can refer directly to the SDKs’ explanation of the iOS integration and the Android integration. You will have to do both in order to have a similar behavior across both platforms.

Dynamic variables are generally custom, and as such can be used with any type of event that can be boiled down to a key/value pair with value types that are valid for the Contentsquare SDK (a string or an unsigned integer). The most common event in that case will thus be a custom event, sent by calling logEvent.

As the integration is exactly the same as the native ones, you can refer directly to the SDKs’ explanation of the iOS integration/Android integration. You will have to do both in order to have a similar behavior across both platforms.