Last active
December 25, 2015 11:19
-
-
Save bhubbard/6968436 to your computer and use it in GitHub Desktop.
Example of custom variable with google analytics for WordPress. https://developers.google.com/analytics/devguides/collection/gajs/eventTrackerGuide http://www.optimisationbeacon.com/analytics/track-website-optimizer-tests-with-yoasts-google-analytics-plugin/ http://www.lunametrics.com/blog/2012/08/28/20-ways-use-custom-variables/#sr=g&m=o&st=(op…
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter('yoast-ga-custom-vars','add_ga_custom_vars',10,2); | |
function add_ga_custom_vars($push, &$customvarslot) { | |
$my_custom_val = "whaterver"; | |
$push[] = "'_setCustomVar',".$customvarslot.",'My_Custom_Variable','".$my_custom_val."',3"; | |
$customvarslot++; | |
return $push; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment