import {
  GoogleAnalyticsTracker,
  GoogleTagManager,
  GoogleAnalyticsSettings
} from "react-native-google-analytics-bridge";

let tracker = new GoogleAnalyticsTracker("UA-12345-0");
let tracker1 = new GoogleAnalyticsTracker("UA-12345-1");
let tracker2 = new GoogleAnalyticsTracker("UA-12345-2");

tracker1.trackScreenView("Home");
// $ExpectError trackScreenView requires a string argument
tracker1.trackScreenView({ foo: bar });
tracker1.trackEvent("Customer", "New");

GoogleAnalyticsSettings.setDispatchInterval(30);
GoogleAnalyticsSettings.setDryRun(true);

GoogleTagManager.openContainerWithId("GT-NZT48")
  .then(() => {
    return GoogleTagManager.stringForKey("pack");
  })
  .then(pack => {
    console.log("Pack: ", pack);
  })
  .catch(err => {
    console.log(err);
  });

tracker2.trackScreenViewWithCustomDimensionValues("Home", { test: "Beta" });
tracker.trackScreenView("Home");
Exemplo n.º 2
0
 static trackEvent(category, action, optionalValues) {
     tracker.trackEvent(category, action, optionalValues);
 }
Exemplo n.º 3
0
 static trackScreenView(screenName) {
     tracker.trackScreenView(screenName);
 }
Exemplo n.º 4
0
 static setUser() {
     tracker.setUser(Gen.getUserId().toString());
 }
Exemplo n.º 5
0
import { GoogleAnalyticsTracker } from 'react-native-google-analytics-bridge'
import { Client } from 'bugsnag-react-native'
import { GOOGLE_ANALYTICS_ID } from '../AppSettings'

const tracker = new GoogleAnalyticsTracker(GOOGLE_ANALYTICS_ID),
	bugsnag = new Client()

/**
 * A module containing logging helper functions
 * @module util/logger
 */
module.exports = {

	/** Log message to the console **/
	log(msg) {
		console.log(msg)
	},

	/** Send a trackScreenView message to Google Analytics **/
	ga(msg) {
		tracker.trackScreenView(msg)
	},

	/** Sends a trackEvent message to Google Analytics **/
	trackEvent(category, action) {
		tracker.trackEvent(category, action)
	},

	/** Sends a trackException message to Bugsnag **/
	trackException(error, metadata, fatal) {
		let severity = 'warning'