• Resolved morktron

    (@morktron)


    Hi, I see it’s easy to add the User-ID as specified by Google, I adapted this code.

    and added it to my child theme via functions.php, like this:

    //* Add User-ID for Analytics for logged in users
    add_action( 'wp_head', 'ux_userID', 99 );
    function ux_userID() {
    	if (is_user_logged_in()) {
            $user = wp_get_current_user();
            $userName = $user->user_login;
        }
    	if (isset($userName)) :
      ?>
      <!-- User-ID for Analytics -->
       <script type="text/javascript">
            ga('set', 'userId', <?php echo(json_encode($userName)); ?>); // Set the user ID using signed-in user_id.
       </script>
      <!-- End User-ID for Analytics -->
      <?php
    	endif;
    }

    However, it is not much use for the MonsterInsights since it’s is separate from the generated Analytics code.

    I see you can add code to MonsterInsights via Settings > Tracking > Compatability however you can’t add php code there.

    So how can this be done? It looks like either pay $99 USD per annum or add Analytics manually without a plugin?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author chriscct7

    (@chriscct7)

    UserId tracking is available with any paid plan starting at $39

    -Chris

    Thread Starter morktron

    (@morktron)

    Thanks for getting back to me Chris, I thought ‘Logged In User Tracking’ refers to tracking a User-ID. Which is on the highest plan only, but maybe I’m wrong then! I’ll risk it and try the paid plan. Thanks again

    Plugin Author chriscct7

    (@chriscct7)

    Hi there,
    We offer 2 different (and you can use them both at the same time) userID tracking. The UserID feature built into Google that transforms the User Explorer report into one by UserID is part of any paid plan. The user ID dimension, which allows for the filtering of all reports by a user ID is only available in the highest one as it’s part of the custom dimensions addon

    -Chris

    Thread Starter morktron

    (@morktron)

    Ok great thanks for clearing that up Chris ??

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Can I add User-ID to the Analytics code?’ is closed to new replies.