Support » Plugin: Analyticator » Enable new GA User-ID feature

Viewing 2 replies - 1 through 2 (of 2 total)
  • I couldn’t get it to work through the plug-in’s admin interface, but the code itself is pretty simple to set up if users are authenticated via WordPress and are logged in (which I require on the site I am using this on):

    In the google-analyticator.php file of this plugin, add the following two lines after line 1183, immediately before the line containing ga('send', 'pageview');

    <?php $user_id = get_current_user_id(); ?>
    ga('set', 'userId', '<?php echo $user_id; ?>');

    The first line simply gets the WordPress user ID and the second one inserts it into the GA tracking code as the UserID variable.

    Of course editing the core plug-in file is a bad idea… but this will work until the plugin supports GA User ID tracking.

    Yes. I would like to see the GA User-ID supported. When do you think this will be included?

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Enable new GA User-ID feature’ is closed to new replies.