最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How to integrate Google Tag Manager with React Native app? - Stack Overflow

programmeradmin1浏览0评论

Recently, the marketing team asked me to add Google Tag Manager in the current pany project, this project is written based on React Native and I searched a lot for this. but no success to found good updated documentation.

I found a react-native-gtm but it is for 4 years ago. also, I find some descriptions for the Native side like this, but it's exactly for the Native iOS not for a React Native project.

Also, I found an article with the React Native: Firebase GTM Integration Installation title. but what is it? What is the meaning of Firebase GTM? what does it mean?

Because as I remember these are separated tools for marketing. Firebase is different from GTM. By the way, this current article is not useful for us because it describes installing on the Native sides. it is not a React Native solution.

So: How to integrate Google Tag Manager with React Native app?

Recently, the marketing team asked me to add Google Tag Manager in the current pany project, this project is written based on React Native and I searched a lot for this. but no success to found good updated documentation.

I found a react-native-gtm but it is for 4 years ago. also, I find some descriptions for the Native side like this, but it's exactly for the Native iOS not for a React Native project.

Also, I found an article with the React Native: Firebase GTM Integration Installation title. but what is it? What is the meaning of Firebase GTM? what does it mean?

Because as I remember these are separated tools for marketing. Firebase is different from GTM. By the way, this current article is not useful for us because it describes installing on the Native sides. it is not a React Native solution.

So: How to integrate Google Tag Manager with React Native app?

Share Improve this question asked Aug 19, 2020 at 11:21 AmerllicAAmerllicA 32.7k17 gold badges143 silver badges167 bronze badges 1
  • Did you happen to find a solution for this? – AbsoluteSith Commented Mar 1, 2021 at 13:14
Add a ment  | 

2 Answers 2

Reset to default 7

The way I went about this was to handle the integration for both platforms natively. So I assume you already have firebase set up, if not follow guide here: https://rnfirebase.io/

FOR iOS:

  1. enter the line below into your podfile pod 'GoogleTagManager'

  2. then run: pod install

  3. in the project root, create a GTM container folder and store the container json file from GTM dashboard in it <project-ios-root>/container/GTM-XXXXXX.json

FOR ANDROID:

  1. in your app level build.gradle file, add the following to the dependencies block:

dependencies {
    // ...
    implementation '.google.android.gms:play-services-tagmanager:17.0.0'
} 2. Create GTM Containers folder in the following path <project-android-root>/app/main/assets/containers and store the JSON file in it as well, <project-android-root>/app/main/assets/containers/GTM-XXXXX.json

note you will get a build error if your gradle build tool is less than version 4. In that case in your project level build.gradle file, update the gradle build tool in the dependencies block with this: classpath(".android.tools.build:gradle:4.0.1").

Also, yes "containers" for android and "container" for iOS for the GTM container folder to store the JSON files.

I found this article very helpful in explaining the differences between Firebase Analytics and Google Analytics. In short, you need to use Firebase Analytics in the app, with a package like react-native-firebase. You can integrate tag manager from the console.

发布评论

评论列表(0)

  1. 暂无评论