Skip to content

Instantly share code, notes, and snippets.

@Coopeh
Created August 23, 2012 13:16
Show Gist options
  • Save Coopeh/3436495 to your computer and use it in GitHub Desktop.
Save Coopeh/3436495 to your computer and use it in GitHub Desktop.
PrimaryBlogger Google Analytics Custom Tracking
<?php if (is_user_logged_in() ) { ?>
_gaq.push(['_setCustomVar', 1, 'logged_in', 'true', 1]);
_gaq.push(['_setCustomVar', 2, 'user-name', '<?php global $current_user; get_currentuserinfo(); echo $current_user->user_login ; ?>', 1]);
_gaq.push(['_setCustomVar', 3, 'blog-address', '<?php $str = get_bloginfo('url');$str = preg_replace('#^https?://#', '', $str);echo $str; ?>', 1]);
<?php } else { ?>
_gaq.push(['_setCustomVar', 1, 'logged_in', 'false', 1]);
_gaq.push(['_setCustomVar', 3, 'blog-address', '<?php $str = get_bloginfo('url');$str = preg_replace('#^https?://#', '', $str);echo $str; ?>', 1]);
<?php } ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment