Piotr Szlagura
Piotr Szlagura

Reputation: 672

User ID not being sent in collect request

I have a problem with sending user id through GTM. I'm trying to configure it with Analytics - Web + App on web.

I have added a dataLayer variable, with following properties:

Then, in my app I'm executing:

window.dataLayer.push({ "user_id" : "some_user_id" });

But this variable never gets sent via collect request for GTM. Could anyone tell me where the problem can be?

I also tried

window.dataLayer.push({ "User ID" : "some_user_id" }); 

but that didn't work too.

Upvotes: 0

Views: 1117

Answers (1)

Michele Pisani
Michele Pisani

Reputation: 14189

If you send it after GTM snippet (so after gtm.js native trigger) you have to add an event in dataLayer and use it to trigger the hit with userId field.

Upvotes: 1

Related Questions