Google Analytics

Automatic event tracking using Google Analytics.

By making your GA account information available to Manipulator, you get automatic pageview and event tracking. To set up Google Analytics, just add the following code to you JS (replacing our values with your own) and make sure these variables are loaded before the u-googleanalytics.js module.

u.ga_account = 'UA-49740096-1'; u.ga_domain = 'manipulator.parentnode.dk';

Or to include tracking in test environments:

u.ga_account = 'UA-49740096-1'; u.ga_domain = 'auto';

Aside from the automatic tracking, shorthand functions are available for custom tracking. To find out more about the customization options for automatic pageview and event tracking, search for Analytics on the documentation main page.

Functions

Util.stats.pageView

Definition

Name
Util.stats.pageView
Syntax
Void = Util.stats.pageView( String url );

Description

Registers pageView on you Google Analytics account

Parameters

url
String url of page view

Returns

Void

Examples

u.stats.pageView('https://manipulator.parentnode.dk');

Uses

JavaScript
  • googleanalytics.js (Universal tracker)
Manipulator

None

Util.stats.event

Definition

Name
Util.stats.event
Syntax
Void = Util.stats.event( Node node, [, JSON _options ] );

Description

Registers event on you Google Analytics account

Parameters

node
Node node event occured on
_options
JSON Optional event settings
Options
event
Event leading to event tracking.
eventCategory
Category label for tracking. Default: Uncategorized
eventAction
Action label for tracking. Default: event.type or Unknown
eventLabel
Additional label for tracking. Default: event.target.url or small except of node content
eventValue
Value label for tracking. Default: Null
nonInteraction
nonInteraction value for tracking. Default: false
hitCallback
Callback for successful tracking. Default: null

Returns

Void

Examples

u.stats.event(node, {"eventCategory":"Video", "eventAction":"Play"});

Uses

JavaScript
  • for ... in
  • switch ... case
  • googleanalytics.js (Universal tracker)
Manipulator
  • Util.text
  • Util.cutString

Files

Main file

  • u-googleanalytics.js

Segment support files

  • none

Segment dependencies

desktop_edge
u-googleanalytics.js + u-string.js
desktop_ie11
u-googleanalytics.js + u-string.js
desktop
u-googleanalytics.js + u-string.js
desktop_ie10
u-googleanalytics.js + u-string.js
desktop_ie9
u-googleanalytics.js + u-string.js
desktop_light
u-googleanalytics.js + u-string.js
tablet
u-googleanalytics.js + u-string.js
tablet_light
u-googleanalytics.js + u-string.js
smartphone
u-googleanalytics.js + u-string.js
mobile
not tested
mobile_light
not tested
tv
u-googleanalytics.js + u-string.js
seo
not supported