Skip to content
This repository was archived by the owner on May 21, 2019. It is now read-only.

Configure tracking code in JS

Compare
Choose a tag to compare
@cbrevik cbrevik released this 20 Mar 10:25
· 198 commits to master since this release

We have now added support for setting your tracker id in JS. Call the function once on app startup to set the tracker id for all subsequent static calls in the app.

const GoogleAnalytics = require('react-native-google-analytics-bridge');
GoogleAnalytics.setTrackerId('UA-12345-1')

A big thanks goes out to @sodik82 for his help and discussion in making this feature possible (and backwards-compatible!). As he said, the reasons for doing this is:

  1. Less manual steps during installation and each RN upgrade.
  2. Follow DRY principle - I have my tracking code in one place instead of two
  3. The less I mess with native code the better - for persons like me that are not familiar with native development :)

Happy tracking!