• Resolved John Els

    (@johnelstx)


    Hi. I want to track logged-in users on my site. I went through the steps on the Google Analytics side to enable it. I checked the “Track User ID” box on the Advanced tab of Analytify. Is that all I need to do?

    After doing that, I checked the GA code on the page and there was no code added after enabling Track User ID and reloading the page. So I added the following code in the Custom JS Code box at the bottom of the Advanced tab of Analytify:

    ga(‘set’, ‘userId’, ‘USER_ID’);

    I copied that from GA. I’m not sure that this code will automatically insert the current user’s ID and send it to GA though. I reloaded the web page and that code is there, but I think it’s just the string “USER_ID” that will be sent, and not the actual user ID. Am I right? How do I fix that?

    Thanks so much,
    John

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi John,

    Once you select the “Track User ID” option then there is no need to add anything in Custom Js box.

    The tracking code only added on frontend if the user is logged-in.

    Thread Starter John Els

    (@johnelstx)

    Hi Burhan,

    Thanks for your speedy reply. I appreciate it.

    Is there a way to send the visitor’s WordPress user ID via the Custom JS box to GA?

    Thread Starter John Els

    (@johnelstx)

    Hi Burhan,

    Don’t worry about my last question. I found a way to insert the GA code that includes the visitor’s user ID.

    Thanks again for your quick response earlier!

    Cheers,
    John

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Correct code to track user ID?’ is closed to new replies.