Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support James Osborne

    (@jamesosborne)

    Hi @hsinyulin,

    Great question! You can enabled a User ID function on your site by following the steps in the guide you provided from the Analytics platform. When it comes to the adding your own User ID Code section (2. Set up User-ID in your tracking code), you can use any one of the following:

    1. Adding your own Google Analytics code to your site manually, which includes your own User ID code snippet
    2. Using Tag Manager to implement your User ID.
    3. If using Site Kit to insert your Google Analytics snippet, you can use the googlesitekit_gtag_opt filter. I have an example of this below. You can replace the USER_ID value below with your own, which you could have generated from your Google Analytics account.
      `add_filter(
      ‘googlesitekit_gtag_opt’,
      function( $opt ) {
      $opt[‘user_id’] = ‘USER_ID’;
      return $opt;
      }
      );`

    If using the filter, with a Site Kit placed snippet, you can add that code snippet ot a custom functions plugin, or a child themes functions.php.

    Let me know if you have any questions with the above.

    Plugin Support James Osborne

    (@jamesosborne)

    As we didn’t receive a response I’ll mark this as resolved. Feel free to open a new support topic if you continue to encounter issues, or reopen this topic and we’d be happy to assist.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to enable Google Analytics User ID ?’ is closed to new replies.