Google Analytics Plugin With Auto Tracking - EasyGA

Google Analytics Plugin With Auto Tracking - EasyGA
File Size: 627 KB
Views Total: 998
Last Update:
Publish Date:
Official Website: Go to website
License: MIT

The EasyGA jQuery plugin makes it easier to insert Google Analytics tracking code to your webpage with auto tracking support.

Supports Page views, Events, Custom dimensions, Virtual page views, and External links. All the options can be passed via HTML data attributes.

How to use it:

1. Insert the necessary jQuery library, GA analytics.js and the EasyGA plugin's JavaScript into the document.

<script src="//"></script>
<script src="//"></script>
<script src="/build/easy-google-analytics.js"></script>

2. Initialize the plugin and insert your own Google Analytics tracking ID. That's it.

window._easyGA = new EasyGA('UA-TRACKING-ID-HERE');

3. Enable the event tracking on a specific element (e.g call to action button).

<button type="submit" 
        Action Button

4. Track virtual page views.

<div data-analytics="trackPageView" 

5. Set custom dimensions and metrics.

<meta data-analytics="customDimension" 

This awesome jQuery plugin is developed by alphagov. For more Advanced Usages, please check the demo page or visit the official website.