Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

[deprecated] A google analytics wrapper which helps to be compatible with German data privacy laws

License

Notifications You must be signed in to change notification settings

Becklyn/Google-Analytics-Wrapper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Google Analytics Wrapper

==========
DEPRECATED
==========

This project is deprecated. Please directly embed the GA code or use a wrapper function (like in the BecklynRadBundle (https://github.com/Becklyn/BecklynRadBundle)) for the embedding.

A google analytics wrapper which helps to be compatible with German data privacy laws.

It only supports universal tracking.

Installation

Download the JavaScript file in the dist/ directory or install it using bower (or any similar package manager).

Usage

At first you need to initialize the API:

Becklyn.Google_Analytics.init(code [, initCallback]);

Parameters:

  • code (required): the Google Analytics tracking code (in the form of "UA-XXXXXXX-X")
  • initCallback (optional): a function, which is called when initializing the google analytics function (receives ga as only parameter)

API

The API is very simple:

/**
 * Toggles the active state.
 * It sets the API inactive, when it was active and vice versa.
 *
 * @return {Boolean} the new active state
 */
Becklyn.Google_Analytics.toggleActive();


/**
 * Returns, whether the user has activated the tracking
 *
 * @returns {Boolean}
 */
Becklyn.Google_Analytics.isActive();

Details

The library automatically sets a cookie when disabling the tracking, which is valid "forever" (until 2100). It will automatically disable the tracking when a user is reentering the page (except they deleted the cookies).

About

[deprecated] A google analytics wrapper which helps to be compatible with German data privacy laws

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published