0

If I send a request like this via Measurement Protocol:

v=1&tid=UA-123456-2&cid=455646456.4646456456&uid=123

What will happen? Given that UID hasn't been set on the site before.
Will this request associate the provided client ID with user ID 123?

Or can I only provide a UID that has already been set on the website like this:

ga('set', 'userId', USER_ID);

Linda Lawton - DaImTo
  • 106,405
  • 32
  • 180
  • 449
Sergey
  • 47,222
  • 25
  • 87
  • 129

1 Answers1

3

The javascript tracker is build on top of the measurement protocol and basically all a "set" call does is to add a parameter to the eventual tracking url; it does not perform any special magic that enables user id tracking.

The tracking works the same way if you create the tracking url via some other way, you can use anything that's in the parameter reference.

Given that UID hasn't been set on the site before. Will this request associate the provided client ID with user ID 123?

That depends on whether or not you've enabled session unification.

Philip Walton
  • 29,693
  • 16
  • 60
  • 84
Eike Pierstorff
  • 31,996
  • 4
  • 43
  • 62
  • Thanks! Just to clarify: are you saying that if I enable session unification and send user ID 123 via a Measurement Protocol alongside client ID, GA will associate the provided client ID with user ID 123? – Sergey Aug 06 '16 at 19:37
  • The rules for session unification are documented here: https://support.google.com/analytics/answer/4574780?hl=en, but broadly speaking, yes. – Eike Pierstorff Aug 06 '16 at 20:25