Custom GA Code functions
-
I am attempting to use the custom GA code section to add a ‘set’ for userId tracking on an internal site however code placed within the entry box is stripped prior to insertion. Is it possible to use variables in these sections as below? Or does this only allow hard coded values to be entered?
ga('set', 'userId', <?php echo get_current_user_id(); ?>);When entering the above, the below text ends up in the script on inspection.
ga('set', 'userId', );My work around has been to enter the below directly inside the ga-google-analytics.php file underneath the custom code section:
if ($gap_custom_code) echo $gap_custom_code . "\n\t\t\t"; echo "ga('set', 'userId', '" . get_current_user_id() . "');" . "\n\t\t\t"
Viewing 6 replies - 1 through 6 (of 6 total)
Viewing 6 replies - 1 through 6 (of 6 total)
The topic ‘Custom GA Code functions’ is closed to new replies.