GoogleAnalytics
Setup
Sign up for Google Analytics and create a new web property.
Add the JavaScript Tracking Snippet to your site. Update the tracking snippet with your tracking Id.
During development and testing it is often helpful to use the debug version of analytics.js. Follow the instructions here to enable it.
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
trackerproperty.
Ecommerce Plugin Setup
Add this line to the end of your tracking snippet:
ga('require', 'ecommerce');. This line must be added after you callga('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 callga('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 repository 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/pages
The last line of the tracking snippet ga('send', 'pageview') hits Google Analytics with a page view that matches the first loaded route. If you're tracking page views using Redux Beacon, be sure to remove this line so the initial page load isn't recorded twice.
event
Docs:
https://developers.google.com/analytics/devguides/collection/analyticsjs/events
timing
Docs:
https://developers.google.com/analytics/devguides/collection/analyticsjs/user-timings
socialInteraction
Docs:
https://developers.google.com/analytics/devguides/collection/analyticsjs/social-interactions
exception
Docs:
https://developers.google.com/analytics/devguides/collection/analyticsjs/exceptions
Don't need to track description or isFatal?
ecommItem
Docs:
https://developers.google.com/analytics/devguides/collection/analyticsjs/ecommerce
Requires:
ecommTransaction
Docs:
https://developers.google.com/analytics/devguides/collection/analyticsjs/ecommerce
Requires:
ecommSend
Docs:
https://developers.google.com/analytics/devguides/collection/analyticsjs/ecommerce
Requires:
Ecommerce Plugin Setup or Enhanced Ecommerce Plugin Setup
ecommClear
Docs:
https://developers.google.com/analytics/devguides/collection/analyticsjs/ecommerce
Requires:
Ecommerce Plugin Setup or Enhanced Ecommerce Plugin Setup
ecommImpression
Docs:
https://developers.google.com/analytics/devguides/collection/analyticsjs/enhanced-ecommerce
Requires:
Enhanced Ecommerce Plugin Setup
ecommProduct
Docs:
https://developers.google.com/analytics/devguides/collection/analyticsjs/enhanced-ecommerce
Requires:
Enhanced Ecommerce Plugin Setup
ecommPromotion
Docs:
https://developers.google.com/analytics/devguides/collection/analyticsjs/enhanced-ecommerce
Requires:
Enhanced Ecommerce Plugin Setup
ecommAction
Docs:
https://developers.google.com/analytics/devguides/collection/analyticsjs/enhanced-ecommerce
Requires:
Last updated