Solved

User ID as a User Property in GTM source

  • 11 April 2024
  • 3 replies
  • 35 views

Badge +1

Hi,

I’m setting up Google Tag Manager as the source for Amplitude events. The event is streaming, but without the User ID as a User Property.

I have created three tags:

  1. All Pages Initialize
  2. All Pages Set User ID
  3. Track Event (track) with the needed trigger

If I add the User ID to the Event Properties of the Track Event tag, the correct User ID appears in the Event Properties in Amplitude. However, I need it to be in the User Property to connect this event to all other events of this user.

According to the manual, since my event is an onboarding event and I need to initialize the User ID at a later time, I have to use setUserId. That's exactly what I need, but it didn’t help.

icon

Best answer by Manabu Takeya 12 April 2024, 09:51

View original

3 replies

Hi Aleksandra,

Happy to help!

Based on the information, I understand you would like to set the User ID (user property) later so that the User ID can be attached to the events moving forward. To do so, you can use the tag type=Set User ID(setUserId) and trigger the tag once the user can be uniquely identified. e.g., once they log in, register, and so on. Here's a reference: https://www.docs.developers.amplitude.com/data/sources/google-tag-manager-client/#setuserid

I hope this helps! Please let me know if you have any questions.

Best regards,
Manabu




P.S. Checkout upcoming events and user meetups on our events page.
Badge +1

Hi Manabu,  

thanks a lot for your help. I had User ID(setUserId) but I triggered it for All pages, I’ve replaced All pages  to my target event and now it works.
So, now I have 3 triggers:

  1. All Pages Initialize
  2.  Set User ID with the needed trigger
  3. Track Event (track) with the needed trigger

And everything is working correctly 
Thanks

Hi Aleksandra,

Thank you for letting me know! I'm glad it worked for you!

Best regards,
Manabu


P.S. Checkout upcoming events and user meetups on our events page.

Reply