React Native bridge to the Google Analytics libraries on both iOS and Android.

Overview

Deprecation notice

On November 13th 2018 Google issued the following statement:

We want to let you know that in October 2019 we will begin to sunset our Google Analytics for mobile apps reporting and the Google Analytics Services SDK.

Data collection and processing for such properties will stop on October 31, 2019.

The message is quite clear, and therefore I am officially deprecating this library. If you want to continue using Google's solutions for analytics, I recommend you move to Google Analytics for Firebase instead.

For React Native, there is a great library called react-native-firebase which implements Analytics (and other Firebase solutions).

I will continue to support this library for minor fixes, but no major changes will occur. The repository itself will be archived sometime in 2019.

Thanks to everyone who have used or contributed to this library!

- Christian (@cbrevik)

GoogleAnalyticsBridge npm version Build Status

Google Analytics Bridge is built to provide an easy interface to the native Google Analytics libraries on both iOS and Android.

Why a native bridge? Why not use just JavaScript?

The key difference with the native bridge is that you get a lot of the metadata handled automatically by the Google Analytics native library. This will include the device UUID, device model, viewport size, OS version etc.

You will only have to send in a few parameteres when tracking, e.g:

import { GoogleAnalyticsTracker } from "react-native-google-analytics-bridge";
let tracker = new GoogleAnalyticsTracker("UA-12345-1");

tracker.trackScreenView("Home");
tracker.trackEvent("testcategory", "testaction");

Version 6 breaking changes!

If you are upgrading to version 6 from an older version, read this wiki post for important details.

The newest version of this library has a new API surface. The API changes are in most cases backwards-compatible.

Important: If you are using ecommerce or custom dimensions, you probably have to migrate to new API if you upgrade!

Content

Installation and linking libraries

  • For React Native >= 0.40 use version 5.0.0 (and up) of this module.
  • For React Native < 0.40 use version 4.0.3.

Install with npm: npm install --save react-native-google-analytics-bridge

Or, install with yarn: yarn add react-native-google-analytics-bridge

Either way, then link with: react-native link react-native-google-analytics-bridge

If it doesn't work immediately after this, consult the manual installation guide. Both Android and iOS has a couple of prerequisite SDKs linked and installed.

Important: Does this library work with Expo? We have to sort of invert the question a bit, because it should be: does Expo work with other libraries? And the answer is no:

The most limiting thing about Expo is that you can’t add in your own native modules without detaching and using ExpoKit.

This includes using create-react-native-app which also makes use of Expo.

Usage

// You have access to three classes in this module:
import {
  GoogleAnalyticsTracker,
  GoogleTagManager,
  GoogleAnalyticsSettings
} from "react-native-google-analytics-bridge";

// The tracker must be constructed, and you can have multiple:
let tracker1 = new GoogleAnalyticsTracker("UA-12345-1");
let tracker2 = new GoogleAnalyticsTracker("UA-12345-2");

tracker1.trackScreenView("Home");
tracker1.trackEvent("Customer", "New");

// The GoogleAnalyticsSettings is static, and settings are applied across all trackers:
GoogleAnalyticsSettings.setDispatchInterval(30);
// Setting `dryRun` to `true` lets you test tracking without sending data to GA
GoogleAnalyticsSettings.setDryRun(true);

// GoogleTagManager is also static, and works only with one container. All functions here are Promises:
GoogleTagManager.openContainerWithId("GT-NZT48")
  .then(() => {
    return GoogleTagManager.stringForKey("pack");
  })
  .then(pack => {
    console.log("Pack: ", pack);
  })
  .catch(err => {
    console.log(err);
  });

// You can also register Function Call tag handlers when the container is open.
GoogleTagManager.registerFunctionCallTagHandler(
  "some_function", // Must be equal to Function Name field when the tag was configured.
  (functionName, tagArguments) => {
    // functionName is passed for convenience. In this example it will be equal to "some_function".
    // tagArguments is an object and is populated based on Tag configuration in TagManager interface.
    console.log("Handling Function Call tag:", functionName);
  }
)

JavaScript API

Table of Contents

GoogleAnalyticsSettings

Settings which are applied across all trackers.

setOptOut

Sets if OptOut is active and disables Google Analytics. This is disabled by default. Note: This has to be set each time the App starts.

Parameters
Examples
GoogleAnalyticsSettings.setOptOut(true);

setDispatchInterval

Sets the trackers dispatch interval. Events, screen views, etc, are sent in batches to your tracker. This function allows you to configure how often (in seconds) the batches are sent to your tracker. Recommended to keep this around 20-120 seconds to preserve battery and network traffic. This is set to 20 seconds by default.

Parameters
Examples
GoogleAnalyticsSettings.setDispatchInterval(30);

setDryRun

When enabled the native library prevents any data from being sent to Google Analytics. This allows you to test or debug the implementation, without your test data appearing in your Google Analytics reports.

Parameters
Examples
GoogleAnalyticsSettings.setDryRun(true);

GoogleAnalyticsTracker

Examples

// Constructing a tracker is simple:
import { GoogleAnalyticsTracker } from "react-native-google-analytics-bridge";
const tracker = new GoogleAnalyticsTracker("UA-12345-1");
tracker.trackScreenView("Home");

// You can have multiple trackers if you have several tracking ids
const tracker2 = new GoogleAnalyticsTracker("UA-12345-2");
// One optional feature as well is constructing a tracker with a CustomDimensionsFieldIndexMap, to map custom dimension field names to index keys:
const fieldIndexMap = { customerType: 1 };
const tracker3 = new GoogleAnalyticsTracker("UA-12345-3", fieldIndexMap);

// This is because the Google Analytics API expects custom dimensions to be tracked by index keys, and not field names.
// Here the underlying logic will transform the custom dimension, so what ends up being sent to GA is { 1: 'Premium' }:
tracker3.trackScreenView("Home", { customDimensions: { customerType: "Premium" } });

// If you do not use a CustomDimensionsFieldIndexMap, you will have to use index as keys instead for custom dimensions:
tracker.trackScreenView("Home", { customDimensions: { 1: "Premium" } });

trackScreenView

Track the current screen/view. Calling this will also set the "current view" for other calls. So events tracked will be tagged as having occured on the current view, Home in this example. This means it is important to track navigation, especially if events can fire on different views.

Parameters
  • screenName string (Required) The name of the current screen
  • payload HitPayload (Optional) An object containing the hit payload (optional, default null)
Examples
tracker.trackScreenView('Home');
// With payload:
const payload = { impressionList: "Sale", impressionProducts: [ { id: "PW928", name: "Premium bundle" } ] };
tracker.trackScreenView("SplashModal", payload);

trackEvent

Track an event that has occured

Parameters
  • category string (Required) The event category
  • action string (Required) The event action
  • eventMetadata EventMetadata (Optional) An object containing event metadata
  • payload HitPayload (Optional) An object containing the hit payload (optional, default null)
Examples
tracker.trackEvent("DetailsButton", "Click");
// Track event with label and value
tracker.trackEvent("AppVersionButton", "Click", { label: "v1.0.3", value: 22 });
// Track with a payload (ecommerce in this case):
const product = {
  id: "P12345",
  name: "Android Warhol T-Shirt",
  category: "Apparel/T-Shirts",
  brand: "Google",
  variant: "Black",
  price: 29.2,
  quantity: 1,
  couponCode: "APPARELSALE"
};
const transaction = {
  id: "T12345",
  affiliation: "Google Store - Online",
  revenue: 37.39,
  tax: 2.85,
  shipping: 5.34,
  couponCode: "SUMMER2013"
};
const productAction = {
  transaction,
  action: 7 // Purchase action, see ProductActionEnum
}
const payload = { products: [ product ], productAction: productAction }
tracker.trackEvent("FinalizeOrderButton", "Click", null, payload);

trackTiming

Track a timing measurement

Parameters
  • category string (Required) The event category
  • interval number (Required) The timing measurement in milliseconds
  • timingMetadata TimingMetadata (Required) An object containing timing metadata
  • payload HitPayload (Optional) An object containing the hit payload (optional, default null)
Examples
tracker.trackTiming("testcategory", 2000, { name: "LoadList" }); // name metadata is required
// With optional label:
tracker.trackTiming("testcategory", 2000, { name: "LoadList", label: "v1.0.3" });

trackException

Track an exception

Parameters
  • error string (Required) The description of the error
  • fatal boolean (Optional) A value indiciating if the error was fatal, defaults to false (optional, default false)
  • payload HitPayload (Optional) An object containing the hit payload (optional, default null)
Examples
try {
  ...
} catch(error) {
  tracker.trackException(error.message, false);
}

trackSocialInteraction

Track a social interaction, Facebook, Twitter, etc.

Parameters
Examples
tracker.trackSocialInteraction("Twitter", "Post");

setUser

Sets the current userId for tracking.

Parameters
  • userId string An anonymous identifier that complies with Google Analytic's user ID policy
Examples
tracker.setUser("12345678");

setClient

Sets the current clientId for tracking.

Parameters
  • clientId string A anonymous identifier that complies with Google Analytic's client ID policy
Examples
tracker.setClient("35009a79-1a05-49d7-b876-2b884d0f825b");

getClientId

Get the client id to be used for purpose of logging etc.

Examples
tracker.getClientId().then(clientId => console.log("Client id is: ", clientId));

Returns Promise<string>

allowIDFA

Also called advertising identifier collection, and is used for advertising features.

Important: For iOS you can only use this method if you have done the optional step 6 from the installation guide. Only enable this (and link the appropriate libraries) if you plan to use advertising features in your app, or else your app may get rejected from the AppStore.

Parameters
  • enabled boolean (Optional) Defaults to true (optional, default true)
Examples
tracker.allowIDFA(true);

setAppName

Overrides the app name logged in Google Analytics. The Bundle name is used by default. Note: This has to be set each time the App starts.

Parameters
Examples
tracker.setAppName("YourAwesomeApp");

setAppVersion

Sets the trackers appVersion

Parameters
  • appVersion string (Required)
Examples
tracker.setAppVersion("1.3.2");

setAnonymizeIp

Sets if AnonymizeIp is enabled If enabled the last octet of the IP address will be removed

Parameters
Examples
tracker.setAnonymizeIp(true);

setSamplingRate

Sets tracker sampling rate.

Parameters
  • sampleRatio number (Required) Percentage 0 - 100
Examples
tracker.setSamplingRate(50);

setCurrency

Sets the currency for tracking.

Parameters
  • currencyCode string (Required) The currency ISO 4217 code
Examples
tracker.setCurrency("EUR");

setTrackUncaughtExceptions

Sets if uncaught exceptions should be tracked Important to note: On iOS this option is set on all trackers. On Android it is set per tracker. If you are using multiple trackers on iOS, this will enable & disable on all trackers.

Parameters

dispatch

This function lets you manually dispatch all hits which are queued. Use this function sparingly, as it will normally happen automatically as a batch. This function will also dispatch for all trackers.

Examples
tracker.dispatch().then(done => console.log("Dispatch is done: ", done));

Returns Promise<boolean> Returns when done

dispatchWithTimeout

The same as dispatch, but also gives you the ability to time out the Promise in case dispatch takes too long.

Parameters
  • timeout number The timeout. Default value is 15 sec. (optional, default -1)
Examples
tracker
  .dispatchWithTimeout(10000)
  .then(done => console.log("Dispatch is done: ", done));

Returns Promise<boolean> Returns when done or timed out

GoogleTagManager

Can only be used with one container. All functions returns a Promise.

Examples

import { GoogleTagManager } from "react-native-google-analytics-bridge";
GoogleTagManager.openContainerWithId("GT-NZT48")
  .then(() => GoogleTagManager.stringForKey("pack"))
  .then(str => console.log("Pack: ", str));

openContainerWithId

Call once to open the container for all subsequent static calls.

Parameters
Examples
GoogleTagManager.openContainerWithId('GT-NZT48').then((..) => ..)

Returns Promise<boolean>

refreshContainer

Refreshes the GTM container. According to Tag Manager documentations for Android can be called once every 15 minutes. No such limitations has been mentioned for iOS containers, though.

Examples
GoogleTagManager.refreshContainer().then((..) => ..)

Returns Promise<boolean>

boolForKey

Retrieves a boolean value with the given key from the opened container.

Parameters
Examples
GoogleTagManager.boolForKey("key").then(val => console.log(val));

Returns Promise<boolean>

stringForKey

Retrieves a string with the given key from the opened container.

Parameters
Examples
GoogleTagManager.stringForKey("key").then(val => console.log(val));

Returns Promise<string>

doubleForKey

Retrieves a number with the given key from the opened container.

Parameters
Examples
GoogleTagManager.doubleForKey("key").then(val => console.log(val));

Returns Promise<number>

pushDataLayerEvent

Push a datalayer event for Google Analytics through Google Tag Manager. The event must have at least one key "event" with event name.

Parameters
  • event DataLayerEvent An Map<String, Object> containing key and value pairs. It must have at least one key "event" with event name
Examples
GoogleTagManager.pushDataLayerEvent({
  event: "eventName",
  pageId: "/home"
}).then(success => console.log(success));

Returns Promise<boolean>

registerFunctionCallTagHandler

Register Function Call tag handler

Parameters

setVerboseLoggingEnabled

Sets logger to verbose, default is warning

Parameters

TimingMetadata

Used when tracking time measurements

Parameters

Examples

const timingMetadata = { name: "LoadList" } // name is a required value when tracking timing
tracker.trackTiming("testcategory", 13000, timingMetadata);

EventMetadata

Used when tracking event

Parameters

Examples

const eventMetadata = { label: "v1.0.3", value: 22 }
tracker.trackEvent("FinalizeOrderButton", "Click", eventMetadata);

HitPayload

The HitPayload object and possible values

Used by the different tracking methods for adding metadata to the hit.

Parameters

Examples

// If you want to do send a purchase payload with an event:
const product = {
  id: "P12345",
  name: "Android Warhol T-Shirt",
  category: "Apparel/T-Shirts",
  brand: "Google",
  variant: "Black",
  price: 29.2,
  quantity: 1,
  couponCode: "APPARELSALE"
};
const transaction = {
  id: "T12345",
  affiliation: "Google Store - Online",
  revenue: 37.39,
  tax: 2.85,
  shipping: 5.34,
  couponCode: "SUMMER2013"
};
const productAction = {
  transaction,
  action: 7 // Purchase action, see ProductActionEnum
}
const payload = { products: [ product ], productAction: productAction }
tracker.trackEvent("FinalizeOrderButton", "Click", null, payload);
// If you want to send custom dimensions with a screen view:
const customDimensions = {
  1: "Beta",
  3: "Premium"
};
const payload = { customDimensions };
tracker.trackScreenView("SaleScreen", payload);

CustomDimensionsByField

  • See: CustomDimensionsFieldIndexMap
  • See: CustomDimensionsByIndex

A dictionary with custom dimensions values and their (mapped) field name keys. In order to use this and send in custom dimensions by field name, you must have provided a CustomDimensionsFieldIndexMap when constructing the tracker.

Examples

const customDimensions = { customerType: "Premium", appType: "Beta", credit: 1200 }
tracker.trackScreenView("Home", { customDimensions });

CustomDimensionsByIndex

  • See: CustomDimensionsFieldIndexMap
  • See: CustomDimensionsByField

A dictionary with custom dimensions values and their index keys.

Examples

const customDimensions = { 1: "Premium", 3: "Beta", 5: 1200 }
tracker.trackScreenView("Home", { customDimensions });

CustomDimensionsFieldIndexMap

  • See: CustomDimensionsFieldIndexMap
  • See: CustomDimensionsByField

A dictionary describing mapping of field names to indices for custom dimensions. This is an optional object used by the tracker.

Examples

// Create something like:
const fieldIndexMap = { customerType: 1 };
// Construct tracker with it:
const tracker = new GoogleAnalyticsTracker("UA-12345-3", fieldIndexMap);
// This allows you to send in customDimensions in the`HitPayload by field name instead of index:
tracker.trackScreenView("Home", { customDimensions: { customerType: "Premium" } });
// If you do not provide a map, you instead have to send in by index:
tracker.trackScreenView("Home", { customDimensions: { 1: "Premium" } });

CustomMetrics

A dictionary with custom metric values and their index keys.

Examples

const customMetrics = { 1: 2389, 4: 15000 }
tracker.trackScreenView("Home", { customMetrics });

DataLayerEvent

The Google Tag Manager DataLayerEvent dictionary.

Populate this event-object with values to push to the DataLayer. The only required property is event.

Parameters

Examples

const dataLayerEvent = {
  event: "eventName",
  pageId: "/home"
};
GoogleTagManager.pushDataLayerEvent(dataLayerEvent);

ProductActionEnum

Enhanced Ecommerce ProductActionEnum

Used by ProductAction when describing the type of product action. The possible values (numbers) are:

  • Detail = 1,
  • Click = 2,
  • Add = 3,
  • Remove = 4,
  • Checkout = 5,
  • CheckoutOption = 6,
  • Purchase = 7,
  • Refund = 8

Product

Enhanced Ecommerce Product

Used by HitPayload when populating product actions or impressions

Parameters

Examples

const product = {
  id: "P12345",
  name: "Android Warhol T-Shirt",
  category: "Apparel/T-Shirts",
  brand: "Google",
  variant: "Black",
  price: 29.2,
  quantity: 1,
  couponCode: "APPARELSALE"
};

ProductAction

Enhanced Ecommerce Product Action

Used by HitPayload when describing a product action

Parameters

Examples

const productAction = {
  transaction,
  action: 7 // Purchase action, see ProductActionEnum
}
const productAction = {
  action: 3 // Add action, see ProductActionEnum
}

Transaction

Enhanced Ecommerce Transaction

Used by ProductAction when populating describing a purchase/transaction

Parameters

Examples

const transaction = {
  id: "T12345",
  affiliation: "Google Store - Online",
  revenue: 37.39,
  tax: 2.85,
  shipping: 5.34,
  couponCode: "SUMMER2013"
};
Issues
  • Updated podspec to include adSupport target as well

    Updated podspec to include adSupport target as well

    This allows people to import AdSupport with podspec by targeting adSupport spec and regular users by not specificing any target (aka not breaking existing users)

    Makes it easier to integrate instead of manual integration of AdSupport

    opened by ptomasroos 10
  • Add dispatchWithCompletionHandler

    Add dispatchWithCompletionHandler

    Add dispatchWithCompletionHandler to ensure sending data when app becomes background. (Fix #211)

    Usage:

    import { Linking, NativeModules } from 'react-native';
    const { GoogleAnalyticsBridge } = NativeModules;
    
    // ... open lind
    tracker.trackEvent('category', 'event name');
    
    GoogleAnalyticsBridge.dispatchWithCompletionHandler()
    .then(() => {
      Linking.openURL('https://example.com')
    })
    
    opened by cpunion 9
  • Added ecommerce tracking

    Added ecommerce tracking

    opened by gnestor 8
  • Ecommerce, + couple of other features

    Ecommerce, + couple of other features

    • Added a java implementation of all the other features.
    • Removed the "legacy" purchase tracking, and left the enhanced one in place.
      • Renamed to trackPurchaseEvent
    • Fixed a few errors in the iOS code.
    • Added a bit more docs on top of everything. @gnestor
    opened by cbrevik 8
  • Fixed gradle warning of deprecated 'compile' configuration

    Fixed gradle warning of deprecated 'compile' configuration

    Description

    While trying to remove all deprecated warnings I stumbled upon this library not being updated yet. A quick and simple fix for this is to use implementation instead of compile.

    The original Gradle warning shown;

    > Configure project :react-native-google-analytics-bridge
    WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
    It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html
    
    opened by ShaPOC 7
  • Add `setAppName`.

    Add `setAppName`.

    In a project we're working on we need to be able to set the appName, so here's a pull request for it. Let me know if it looks legit.

    Thanks for the cool project!

    opened by alpacaaa 7
  • Adding custom dimension support

    Adding custom dimension support

    Added support for setting custom dimension values.

    opened by peteclark3 6
  • Validate type definition as part of CI

    Validate type definition as part of CI

    Embarrassingly, my last PR (#216) introduced a syntax error in the type definition. This PR fixes that error and also adds dtslint as part of the Travis CI process, so that this won't happen again.

    • Fixes the syntax error
    • Modifies the npm test script to run dtslint on the type definition
    • Adds tslint rules so that the existing index.d.ts passes linting
    • Updates .travis.yml to use a newer version of Node, as required by dtslint

    Here's an example build showing the original error:

    https://travis-ci.org/MichaelMarner/react-native-google-analytics-bridge/builds/334576677

    Sorry again for introducing the error in the first place.

    opened by MichaelMarner 6
  • Add support for Function Call tag

    Add support for Function Call tag

    Chages in this PR:

    • Loads default GTM container in Android if present. This behavior is currently disabled by always passing -1 to loadContainerPreferFresh method.
    • Adds support to register GTM Function Call tag handlers in React Native environment. (closes #256)
    opened by fshafiee 5
Releases(v7.1.0)
  • v7.1.0(Mar 15, 2019)

  • v7.0.0(Dec 19, 2018)

    What’s Changed

    • Fixed gradle warning of deprecated 'compile' configuration (#294) @ShaPOC
    • Remove old examples, add new RN 57 example (#297) @cbrevik

    Major version?

    Since the implementation configuration is not valid for older versions of Gradle, this is a breaking change and therefore a major version. You should be on a newer React Native version (0.57+) for this version.

    Source code(tar.gz)
    Source code(zip)
  • v6.1.1(Oct 15, 2018)

  • v6.1.0(Sep 6, 2018)

    As per issues #238 & #247, this release fixes the build issue when using Play Services v15+.

    This should allow for better compat with other React Native modules using a Play Services version >=15.

    The module automatically uses the highest version, but if you want to use a specific version, this can be done through the googlePlayServicesVersion project build property in Gradle. You can specify it in <your-RN-app>/android/build.gradle:

    buildscript {
        ext {
            googlePlayServicesVersion = "16.0.3"
        }
    	// ... rest of gradle buildscript
    }
    

    See example file.

    This change should be backwards compatible with older Play Services versions as well (at least >= 10).

    Source code(tar.gz)
    Source code(zip)
  • v6.0.0(Aug 28, 2018)

    This module started out as a simple project with an aim to abstract away the native side of the Google Analytics library. The hope was that we could have simple functions like trackScreenView, trackEvent, and developers wouldn't have to think about stuff like building "Hits" and dispatching them.

    But as use-cases have become complex, the API of the module became messy. This release hopes to put that right.

    The API should mostly be backwards-compatible, except those special use-cases. See this wiki post for more details.

    This release also includes a more fully developed enhanced e-commerce, which lets you track even more product actions and impressions.

    Source code(tar.gz)
    Source code(zip)
  • v5.8.0(Jun 22, 2018)

    #256 Support of custom JS function tags in Google Tag Manager, which are triggered from rules setup in your container.

    Thanks to @farzadshafiee for the implementation!

    Register a function tag by calling:

    GoogleTagManager.registerFunctionCallTagHandler(
      "some_function",
      (functionName, tagArguments) => {
        console.log("Handling Function Call tag:", functionName);
        console.log("args:", tagArguments);
     }
    
    Source code(tar.gz)
    Source code(zip)
  • v5.5.0(Jan 24, 2018)

  • v5.1.0(Jun 22, 2017)

  • v5.0.0(Jan 14, 2017)

    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.

    Source code(tar.gz)
    Source code(zip)
  • v4.0.0(Nov 5, 2016)

    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!

    Source code(tar.gz)
    Source code(zip)
  • v3.1.0(Sep 4, 2016)

    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!

    Source code(tar.gz)
    Source code(zip)
  • 3.0.0(Jul 27, 2016)

    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!

    Source code(tar.gz)
    Source code(zip)
  • v2.1.0(May 21, 2016)

    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! 🍰

    Source code(tar.gz)
    Source code(zip)
  • v2.0.0(Apr 24, 2016)

    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!

    Source code(tar.gz)
    Source code(zip)
  • v1.3.0(Mar 20, 2016)

    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!

    Source code(tar.gz)
    Source code(zip)
  • v1.2.0(Mar 18, 2016)

  • v1.1.0(Mar 11, 2016)

    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
    Source code(tar.gz)
    Source code(zip)
  • v1.0.0(Feb 29, 2016)

    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);
    Source code(tar.gz)
    Source code(zip)
  • v0.4.0(Feb 8, 2016)

    Track user timings, which allows you to measure things like resource load times, etc.

    Thanks to @hedblad for providing the implementation of this feature!

    GoogleAnalytics.trackTiming('testcategory', 13000, {name: 'loadList', label: 'v1.0.3'});
    
    Source code(tar.gz)
    Source code(zip)
  • v0.3.0(Jan 26, 2016)

    Several new methods are now available;

    • trackPurchaseEvent
    • trackException
    • trackSocialInteraction
    • setUser
    • allowIDFA

    Thanks to @gnestor for helping out!

    Source code(tar.gz)
    Source code(zip)
  • v0.2.0(Jan 7, 2016)

    This release includes:

    • Setting the deployment target to iOS 7.0 (default for React Native projects).
    • Enabling bitcode

    The Google Analytics iOS SDK was also upgraded to 3.15 to support bitcode.

    Source code(tar.gz)
    Source code(zip)
  • v0.1.0(Jan 2, 2016)

    This release includes the ability to set if the dryRun flag should be enabled or not.

    When enabled, GoogleAnalytics.setDryRun(true), the native library prevents any data from being sent to Google Analytics. This allows you to test or debug the implementation, without your test data appearing in your Google Analytics reports.

    Source code(tar.gz)
    Source code(zip)
  • v0.0.3(Dec 29, 2015)

Owner
Idéhub
Idéhub
A React Native wrapper for Mixpanel tracking

DEPRECATED Please check out the official bindings at https://github.com/mixpanel/mixpanel-react-native Description React Native wrapper for Mixpanel l

Davide Scalzo 457 Oct 13, 2021
🤖 React Native Android widgets bridged to JS, a proof of concept

React Native Android Widget Proof Of Concept ?? Using React Native and having Android widgets is possible. Create buttons in Java / Android XML to tri

Netbeast 186 Sep 21, 2021
React Native Flurry SDK

React Native Flurry SDK (react-native-flurry-sdk) A React Native plugin for Flurry SDK Tutorial and sample project are now available at https://github

Flurry, Inc. 40 Oct 14, 2021
React Native wrapper for SegmentIO's Analytics SDK

RNSegmentIOAnalytics Written by Tal Kain [email protected] Based on SegmentIO (https://segment.com) Analytics project. The iOS SDK can be found here: https

Smore 68 May 27, 2019
A React Native library for Fabric, Crashlytics and Answers

react-native-fabric A React Native library for Fabric, Crashlytics and Answers Versioning For React Native > 0.40 use version 0.5.1 For React Native <

Cory Smith 1.3k Oct 8, 2021
Call any JS functions from your native code

react-native-eval React has a good tutorial how to integrate React View to already existing application, but it doesn't provide a good way if you deci

Artem Yarulin 79 Sep 10, 2021
Google Analytics for React Native! Compatible with react-native-ab

react-native-google-analytics is no longer maintained ?? Check out expo-firebase-analytics for universal React support (iOS, Android, web, & Electron)

null 386 Sep 10, 2021
Library for UI snapshot testing of React Native

pixels-catcher Library for testing React Native UI components and screens Getting started Install and link $ npm install pixels-catcher --save-dev or

Maksym Rusynyk 87 Oct 14, 2021
Snoopy is a profiling tool for React Native, that lets you snoop on the React Native Bridge.

React Native Snoopy UPDATE: I wrote an article with the story behind this library. Snoopy is a profiling tool for React Native, that lets you snoop on

Dotan J. Nahum 514 Oct 20, 2021
React Native boilerplate supporting multiple platforms: Android, iOS, macOS, Windows, web, browser extensions, Electron.

React Native boilerplate supporting multiple platforms: Android, iOS, macOS, Windows, web, browser extensions, Electron.

Matteo Mazzarolo 1.1k Oct 15, 2021
A contacts library for React Native using JSI

A contacts library for React Native using JSI

Marc Rousavy 105 Oct 11, 2021
An HTTP network request monitor for React Native with in-app interface for iOS and Android with no native code

react-native-network-logger An HTTP traffic monitor for React Native including in app interface. An alternative to Wormholy but for both iOS and Andro

Alex Brazier 219 Oct 8, 2021
React Native wrapper for uxcam.com

react-native-ux-cam Deprecation of this repo As of version 5.1.15, published 5 March 2020, we are moving to https://github.com/uxcam/react-native-ux-c

Mark Miyashita 50 Aug 9, 2021
iOS Today Widget in React Native

React Native Today Widget Experimental library investigating limits of implementation iOS App Extensions using React Native. Sample result from Comple

Matěj Kříž 343 Oct 3, 2021
Easier React Native upgrades by clearly exposing changes from a version to another. :rocket: And what better way than to purge, init, then diff? Spoiler: there's no better way. 😎

RN diff PURGE This repository exposes an untouched React Native app generated with the CLI npx @react-native-community/cli init RnDiffApp. Each new Re

React Native Community 990 Oct 17, 2021
react-native package to detect call states

React Native Call Detection ?? ?? This package helps to detect different call states like Incoming, Disconnected, Dialing and Connected for iOS. For a

Pritesh Nandgaonkar 153 Oct 5, 2021
Ship React Native .jsbundles compressed by Brotli algorithm.

Ship React Native .jsbundles compressed by Brotli algorithm.

Ivan Moskalev 25 Oct 12, 2021
A component for rendering A/B tests in React Native

react-native-ab A component for rendering A/B tests in React Native. Getting started npm install [email protected] --save Obtaining your metrics

Loch Wansbrough 180 May 19, 2021
:iphone: React Native Package Manager

Dear friends, Last November me (@Kureev) and Mike (@grabbou) started RNPM. We aimed to bring you a better developer experience and bridge the tooling

rnpm 2.5k Oct 17, 2021