Releases: idehub/react-native-google-analytics-bridge
Major release because of breaking RN v0.40
This is a small major release which only supports RN v0.40.0
and up.
It is because of a breaking change introduced in RN v0.40.0
, in which they've moved the iOS native headers.
Multiple tracker support + much more!
Okay this is a huge release. Thanks to the fantastic work by @MrBr, we now have support for multiple trackers! 🏆
From now on, you will have to construct the GoogleAnalyticsTracker
class:
import { GoogleAnalyticsTracker } from 'react-native-google-analytics-bridge';
let tracker = new GoogleAnalyticsTracker('UA-12345-1');
This means the old way of using the tracker statically, GoogleAnalytics.trackScreenView('Home')
, is deprecated. It's not a breaking change yet, but I recommend updating your code since that will probably be removed in a later version. This also means that setting your trackerId
natively in Info.plist etc is deprecated.
Things have also been moved around a bit, a few settings methods have been moved to the new GoogleAnalyticsSettings
type. It is still used statically since settings are applied across all trackers.
Also since the previous release we now have trackMultiProductsPurchaseEventWithCustomDimensionValues
added to the tracker, courtesy of @malaman. 💪 Thanks!
Datalayer push ability + track multiple products
Now you have the ability to push to the datalayer with GTM with pushDataLayerEvent(dictionary = {})
. Thanks to @rdesai40!
We also have the ability to track multiple products with ecommerce on GA: trackMultiProductsPurchaseEvent(products, transaction, eventCategory, eventAction)
. Thanks to @crnbtn for implementing that!
Thanks to @dmueller39, @wilsonpage & @iotashan for other fixes as well!
Update Android dependency + setAppVersion
This release is tagged as a major release, since the GA Android dependency has had a major release.
It is now 9.+
, remember to update your SDKs in the Android SDK Manager!
Thanks to @AndreyNikiforov we now also have a setAppVersion(appVersion)
method. Thanks for your contribution!
Config appName and tracking custom dimension values
Three new functions available on the GoogleAnalytics
type!
You now have the ability to explicitly set the appName. This is done by calling setAppName(appName)
.
Thanks to @alpacaaa for the implementation! 🎆
Next up is the ability to track custom dimension values. Since this needs to be done along with tracking a screenView or event, there are now two new methods for this:
trackScreenViewWithCustomDimensionValues(screenName, dimensionIndexValueDict)
trackEventWithCustomDimensionValues(category, action, optionalValues, dimensionIndexValueDict)
Thanks to @peteclark3 for fixing that for us! 🍰
Google Tag Manager and A/B-testing
Tag Manager
This release includes a Google Tag Manager implementation, which allows you to pull values out of your containers. The API is simple:
- openContainerWithId(containerId)
- stringForKey(key)
- boolForKey(key)
- doubleForKey(key)
All these returns a Promise
.
A/B-testing
The motivation behind this release was to enable simple A/B-testing, consult this section in the readme.
Breaking changes:
The Tag Manager-implementation uses Promise
, which means that this release requires React Native 0.19+!
Thanks to @libinlu89 for helping me kickstart this!
Configure tracking code in JS
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:
- Less manual steps during installation and each RN upgrade.
- Follow DRY principle - I have my tracking code in one place instead of two
- The less I mess with native code the better - for persons like me that are not familiar with native development :)
Happy tracking!
Added support for AnonymizeIP and OptOut
Thanks to @CeeEll for his PR providing this functionality!
Setting iOS logLevel
In order to control the logLevel
you can add an item in your Info.plist with the key GAILogLevel
. The value you use is a number which corresponds to your desired log-level:
- 0: None
- 1: Errors
- 2: Warnings
- 3: Info
- 4: Verbose
Roadmap completion with simple configuration
With this release you are able to configure the tracker defaults like dispatch interval and tracking of uncaught exceptions.
Since this completes the current road map, I've decided to make this a major release.
The two methods are:
GoogleAnalytics.setDispatchInterval(30);
GoogleAnalytics.setTrackUncaughtExceptions(true);