bhubbard
10/13/2013 - 11:13 PM

Example of custom variable with google analytics for WordPress. https://developers.google.com/analytics/devguides/collection/gajs/eventTrack

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;
}