Skip to content

Instantly share code, notes, and snippets.

@eloycoto
Created September 3, 2013 09:00
Show Gist options
  • Save eloycoto/6421379 to your computer and use it in GitHub Desktop.
Save eloycoto/6421379 to your computer and use it in GitHub Desktop.
var tracker = Piwik.getTracker( '{{PIWIK_URL}}', '1' );
var info = tracker.getVisitorInfo();
var optin = false;
var alreadyTracking = info[0] != '1' || info[3] > 0;
if (!alreadytracking) {
optin = confirm( 'Opt-in to use cookies?' );
}
if (optin || alreadyTracking) {
tracker.enableLinkTracking();
tracker.trackPageView();
// etc
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment