UserId, CID in measurement protocol

后端 未结 1 857
野性不改
野性不改 2021-02-10 06:13

Measurement protocol To Identify a new user vs. returning user , can we use the user id field . ( i.e we can hash username or other identifier unique to the user and associate

相关标签:
1条回答
  • 2021-02-10 07:01

    A long time after but that could help other people ...

    My understanding is that the CID references a device while the UserID references an authenticated user.

    So basically, all the hits with the same Client ID or User ID will be associated to the same user in GA (take a look at session unification though).

    "A client id represents a unique device/browser. Whereas a user id represents a unique user that may interact with your website using multiple devices/browsers." from Optimizesmart article

    A session in GA is represented by a group of hits both :

    • less than 30 minutes away from the previous hit
    • having the same source/medium/campaign
    • having the same CID

    You don't need to track the session expiration manually, you can always send the same CID, Google will handle the sessions split. You only need to explicit the session expiration if your own sense of session is different from Google's.

    So in your case, I would generate a CID for each device that is connecting to the service and let Google handle the sessions split for that device.

    If you add a UserID for cross-device tracking, then Google will consider all the sessions with the same UserID as being a single user.

    Example :

    • User A comes on your website on device X (CID = X)
    • User A comes on your website on device X 2 hours later (CID = X)

    At that point Google will understand 2 sessions for 1 user.

    • User A logs on your website on device X (CID = X, UID = A)
    • User A comes on your mobile app on device Y (CID = Y)
    • User A logs on your mobile app (CID = Y, UID = A)

    With session unification enabled, the UserID A will be propagated to all the session on device Y so Google will understand 3 sessions, (2 devices), 1 user.

    Returning users are calculated with that scheme, here User A generated 1 new visit and 2 returning visits.

    I'm currently working with that pattern and everything looks just fine but it's a touchy subject and if anyone knows better or has remarks and advices, I would take them !

    0 讨论(0)
提交回复
热议问题