2017 © Pedro Peláez
 

silverstripe-vendormodule silverstripe-analytics-js

Google Universal Analytics.js tracking code for SilverStripe

image

axllent/silverstripe-analytics-js

Google Universal Analytics.js tracking code for SilverStripe

  • Friday, February 2, 2018
  • by axllent
  • Repository
  • 1 Watchers
  • 13 Stars
  • 1,496 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 3 Forks
  • 0 Open issues
  • 13 Versions
  • 13 % Grown

The README.md

Google Universal Analytics for Silverstripe

Please note that the functionality provided by this module is now fairly redundant since the release of Google Analytics 4 (GA4), and is no longer in active development.

If you're looking for an alternative then take a look at springtimesoft/silverstripe-tracking-scripts., (*1)

An extension to add Google Universal Analytics gtag() tracking code (not to be confused with Google Tag Manager) to your Silverstripe templates., (*2)

It automatically includes optional unobtrusive event tracking for all outbound links & "asset downloads", as well as event tracking for 404 and error pages, email & telephone links., (*3)

Features

  • Google Universal Analytics (gtag.js) code injected automatically into <head> of page to prevent JavaScript conflicts due to loading order (if you are using custom gtag() functions in your other code.
  • Automatic pageview tracking for all configured accounts, including tracking of 404 & 500 page errors (tracked as "Page Not Found" / "Page Error" events).
  • Unobtrusive outbound, download, email & tel: link tracking - monitors all page clicks, rather than on page load (ie: works with links including those generated by Ajax etc on the page after page load).
  • Uses Google Analytics hitCallback for tracking for outgoing links to register before load (ie: when no link target is set) to ensure tracker is successfully run before redirection.
  • Tracking codes are automatically changed to UA-DEV-[1-9] if SS_ENVIRONMENT_TYPE is not live, or if page URL matches ?flush= to prevent bad data capture.

Event tracking

Additional event tracking is automatically enabled by default for:, (*4)

  • File downloads (all non-image files in the assets folder) are tracked as "Downloads".
  • Outgoing links are tracked as "Outgoing Links".
  • Email (mailto:) links are tracked as "Email Links".
  • Phone (tel:) links are tracked as "Phone Links".

Event category names (eg: "Outgoing Links", "Downloads" etc) can be configured in your yaml config., (*5)

Note: Event tracking only works with regular (left-or-middle) mouse button clicks (including combinations with Ctrl/Shift/Meta keys). Tracking is bypassed if the user right-clicks on a link and selects an action from the context menu (open in new tab, save as etc...). Unfortunately there is no way around this without disabling the content menu entirely., (*6)

Requirements

  • Silverstripe ^4 || ^5

For the deprecated analytics.js tracking method for Silverstripe 4, please refer to the analytics.js branch., (*7)

For Silverstripe 3, please refer to the Silverstripe3 branch., (*8)

Installation via Composer

You can install it via composer with, (*9)

composer require axllent/silverstripe-analytics-js

Basic usage

Once installed the extension is automatically loaded if you provide at least one tracking account in your config yaml file (eg) app/_config/analytics.yml, (*10)

Axllent\AnalyticsJS\AnalyticsJS:
  tracker:
    - ['config', 'UA-1234567-1']

The syntax is very similar to the official documentation, so things like secondary trackers or other configurations can be easily added., (*11)

Axllent\AnalyticsJS\AnalyticsJS:
  tracker:
    - ['config', 'UA-1234567-1']          # default account [required]
    - ['config', 'UA-1234567-2']          # add secondary tracker
    - ['set', 'forceSSL', true]           # force tracking to use SSL
    - ['require', 'ecommerce', 'ecommerce.js']  # load ecommerce extension
  track_links: false                      # disable external link & asset tracking
  ignore_link_class:  "notrack"           # if "track_links", then ignore external links with the "notrack" class
  compress_js: false                      # do not compress inline JavaScript
  primary_gtag_id: "UA-1234567-1"         # set the default tracking id to be used when loading gtag (defaults to the first tracker)

Please refer to the Configuration.md for all configuration options., (*12)

To start live tracking, make sure your website is in live mode, or if running in dev or staging that you have the track_in_dev_mode: true option., (*13)

The Versions

02/02 2018

dev-master

9999999-dev https://github.com/axllent/silverstripe-analytics-js

Google Universal Analytics.js tracking code for SilverStripe

  Sources   Download

MIT The MIT License (MIT)

The Requires

 

analytics tracking silverstripe googleanalytics

02/02 2018

dev-silverstripe3

dev-silverstripe3 https://github.com/axllent/silverstripe-analytics-js

Google Universal Analytics.js tracking code for SilverStripe

  Sources   Download

MIT The MIT License (MIT)

The Requires

 

analytics tracking silverstripe googleanalytics

30/11 2017

2.0.2

2.0.2.0 https://github.com/axllent/silverstripe-analytics-js

Google Universal Analytics.js tracking code for SilverStripe

  Sources   Download

The MIT License (MIT)

The Requires

 

analytics tracking silverstripe googleanalytics

30/11 2017

3.1.5

3.1.5.0 https://github.com/axllent/silverstripe-analytics-js

Google Universal Analytics.js tracking code for SilverStripe

  Sources   Download

The MIT License (MIT)

The Requires

 

analytics tracking silverstripe googleanalytics

16/10 2017

3.1.4

3.1.4.0 https://github.com/axllent/silverstripe-analytics-js

Google Universal Analytics.js tracking code for SilverStripe

  Sources   Download

The MIT License (MIT)

The Requires

 

analytics tracking silverstripe googleanalytics

04/08 2017

3.1.3

3.1.3.0 https://github.com/axllent/silverstripe-analytics-js

Google Universal Analytics.js tracking code for SilverStripe

  Sources   Download

The MIT License (MIT)

The Requires

 

analytics tracking silverstripe googleanalytics

30/06 2017

3.1.2

3.1.2.0 https://github.com/axllent/silverstripe-analytics-js

Google Universal Analytics.js tracking code for SilverStripe

  Sources   Download

The MIT License (MIT)

The Requires

 

analytics tracking silverstripe googleanalytics

16/02 2017

3.1.0

3.1.0.0 https://github.com/axllent/silverstripe-analytics-js

Google Universal Analytics.js tracking code for SilverStripe

  Sources   Download

The MIT License (MIT)

The Requires

 

analytics tracking silverstripe googleanalytics

15/02 2017

2.0.1

2.0.1.0 https://github.com/axllent/silverstripe-analytics-js

Google Universal Analytics.js tracking code for SilverStripe

  Sources   Download

The MIT License (MIT)

The Requires

 

analytics tracking silverstripe googleanalytics

31/01 2017

3.0.0

3.0.0.0 https://github.com/axllent/silverstripe-analytics-js

Google Universal Analytics.js tracking code for SilverStripe

  Sources   Download

The MIT License (MIT)

The Requires

 

analytics tracking silverstripe googleanalytics

15/06 2016

2.0.0

2.0.0.0 https://github.com/axllent/silverstripe-analytics-js

Google Universal Analytics.js tracking code for SilverStripe

  Sources   Download

The MIT License (MIT)

The Requires

 

analytics tracking silverstripe googleanalytics

01/04 2016

1.1.0

1.1.0.0 https://github.com/axllent/silverstripe-analytics-js

Google Universal Analytics.js tracking code for SilverStripe

  Sources   Download

The MIT License (MIT)

The Requires

 

analytics tracking silverstripe googleanalytics

20/01 2016

1.0.0

1.0.0.0 https://github.com/axllent/silverstripe-analytics.js

Google Universal Analytics.js tracking code for SilverStripe 3

  Sources   Download

The MIT License (MIT)

The Requires

 

analytics tracking silverstripe googleanalytics