GoogleAnalytics

Setup

  1. Sign up for Google Analytics and create a new web propertyarrow-up-right.

  2. Add the JavaScript Tracking Snippetarrow-up-right to your site. Update the tracking snippet with your tracking Idarrow-up-right.

    During development and testing it is often helpful to use the debug version of analytics.js. Follow the instructions herearrow-up-right to enable it.

  3. Install the target:

     npm install --save @redux-beacon/google-analytics

Multiple Trackers Setup

  • This target supports named trackers. Add the following line to the tracking snippet for each named tracker:

    ga('create', 'UA-XXXXX-Z', 'auto', 'clientTracker');
  • The tracker can be specified in each event definition

    using the tracker property.

Ecommerce Plugin Setup

  • Add this line to the end of your tracking snippet: ga('require', 'ecommerce');. This line must be added after you call ga('create', 'UA-XXXXX-Y').

    Google Analytics will fail silently if you try to use these events without adding the require call in your initial tracking code. It is also not recommended to use GA's basic analytics plugin if you're also going to use the enhanced ecommerce plugin.

Enhanced Ecommerce Plugin Setup

  • Add this line to the end of your tracking snippet: ga('require', 'ec');. This line must be added after you call ga('create', 'UA-XXXXX-Y').

    Google Analytics will fail silently if you try to use these events without adding the require call in your initial tracking code. It is also not recommended to use GA's basic analytics plugin if you're also going to use the basic ecommerce plugin.

Usage

Event Definitions

Don't see your event listed? Please submit a pull request to the Redux Beacon repositoryarrow-up-right with the missing event. Use the source of the existing event-helpers to guide your work. If you need any support feel free to make the pull request with all you're able to do. We can fill in the gaps from there.

pageView

Docs:

https://developers.google.com/analytics/devguides/collection/analyticsjs/pagesarrow-up-right

triangle-exclamation

event

Docs:

https://developers.google.com/analytics/devguides/collection/analyticsjs/eventsarrow-up-right

timing

Docs:

https://developers.google.com/analytics/devguides/collection/analyticsjs/user-timingsarrow-up-right

socialInteraction

Docs:

https://developers.google.com/analytics/devguides/collection/analyticsjs/social-interactionsarrow-up-right

exception

Docs:

https://developers.google.com/analytics/devguides/collection/analyticsjs/exceptionsarrow-up-right

Don't need to track description or isFatal?

ecommItem

Docs:

https://developers.google.com/analytics/devguides/collection/analyticsjs/ecommercearrow-up-right

Requires:

Ecommerce Plugin Setup

ecommTransaction

Docs:

https://developers.google.com/analytics/devguides/collection/analyticsjs/ecommercearrow-up-right

Requires:

Ecommerce Plugin Setup

ecommSend

Docs:

https://developers.google.com/analytics/devguides/collection/analyticsjs/ecommercearrow-up-right

Requires:

Ecommerce Plugin Setup or Enhanced Ecommerce Plugin Setup

ecommClear

Docs:

https://developers.google.com/analytics/devguides/collection/analyticsjs/ecommercearrow-up-right

Requires:

Ecommerce Plugin Setup or Enhanced Ecommerce Plugin Setup

ecommImpression

Docs:

https://developers.google.com/analytics/devguides/collection/analyticsjs/enhanced-ecommercearrow-up-right

Requires:

Enhanced Ecommerce Plugin Setup

ecommProduct

Docs:

https://developers.google.com/analytics/devguides/collection/analyticsjs/enhanced-ecommercearrow-up-right

Requires:

Enhanced Ecommerce Plugin Setup

ecommPromotion

Docs:

https://developers.google.com/analytics/devguides/collection/analyticsjs/enhanced-ecommercearrow-up-right

Requires:

Enhanced Ecommerce Plugin Setup

ecommAction

Docs:

https://developers.google.com/analytics/devguides/collection/analyticsjs/enhanced-ecommercearrow-up-right

Requires:

Enhanced Ecommerce Plugin Setup

Last updated