Skip to content

Instantly share code, notes, and snippets.

  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
Conditionally load Google Analytics Tracking Code
//Conditionally load Google Analytics tracking code
//GA code optimized by Html5boiler plate --
if ( !window._gat || !window._gat._getTracker ) {
var _gaq=[["_setAccount","UA-XXX-1"],["_trackPageview"]];
(function(d,t){var g=d.createElement(t),s=d.getElementsByTagName(t)[0];g.async=1;
Copy link

I tried to use this replacing the condition with the role of my users:
if ($.inArray('student',ENV['current_user_roles']) === 1 ) { ...
But it seems to track everyone, regardless of whether they are of the role student or not. Any advice?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment