Example of custom variable with google analytics for WordPress. https://developers.google.com/analytics/devguides/collection/gajs/eventTrackerGuide
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;
}