August 23, 2012

Useful WordPress Google Analytics Tracking Code

On PrimaryBlogger we like to track custom variables to monitor how our service is being used. Here’s some of the code we use to check if users and logged in, what their username is and what blogs they’re visiting.

  _gaq.push(['_setCustomVar', 1, 'logged_in', 'true', 1]);
  _gaq.push(['_setCustomVar', 2, 'user-name', 'user_login ; ?>', 1]);
  _gaq.push(['_setCustomVar', 3, 'blog-address', '', 1]);

  _gaq.push(['_setCustomVar', 1, 'logged_in', 'false', 1]);
  _gaq.push(['_setCustomVar', 3, 'blog-address', '', 1]);

Leave a Reply

Your email address will not be published. Required fields are marked *

css.php