amphtml icon indicating copy to clipboard operation
amphtml copied to clipboard

Client id bug

Open avimehta opened this issue 10 years ago • 8 comments

It looks like when a user visits an amp page for the first time from a viewer, a new client id (say id1) is generated for them. This id is stored and managed by the viewer.

if the user then visits a page on cdn.ampproject.org and if a client id (say id2) is generated in this viewer-less scenario, it is stored in localStorage.

When the user goes back to a page that is hosted in the viewer, id1 should be used as client id but it looks like id2 is being used currently.

cc @cramforce

avimehta avatar Jan 27 '16 18:01 avimehta

@avimehta @rudygalfi This is easy to change, but it solves one case of double-counting.

cramforce avatar Jan 27 '16 19:01 cramforce

It won't help much with double-counting because we still have two ids. one for viewer and viewer-less case. But the fix is still welcome :).

avimehta avatar Jan 27 '16 19:01 avimehta

Well, it makes a user that went to cdn.ampproject.org once be counted as the same user for all viewers.

cramforce avatar Jan 27 '16 19:01 cramforce

that is true. I am not sure how I feel about this. After talking to @btownsend, it seemed like this should be fine. Re closing this bug without any changes is fine for now. If something comes up later, we can revisit.

avimehta avatar Jan 28 '16 00:01 avimehta

Just want to make sure I'm following this correctly. The client ID is intended to be unique per origin and per analytics endpoint, but NOT per viewer:

  • (A) Pub P1, Endpoint E1, Viewer V1 ==> Client id CID1
  • (B) Pub P1, Endpoint E2, Viewer V1 ==> Client id CID2
  • (C) Pub P2, Endpoint E1, No viewer ==> Client id CID2
  • (D) Pub P2, Endpoint E1, Viewer V1 ==> Client id CID2
  • (E) Pub P2, Endpoint E1, Viewer V2 ==> Client id CID2

It sounds like if (C) happens first, followed by (D) or (E), you'd get another client id CID3, at least the first time you do (D) or (E) in their respective viewers. Is this correct?

rudygalfi avatar Feb 01 '16 04:02 rudygalfi

@rudygalfi your example is correct.

cramforce avatar Feb 01 '16 15:02 cramforce

Looking at this again, I understood the implementation differently. @cramforce can you correct me where I am wrong?

(A) Pub P1, Endpoint E1, Viewer V1 ==> Client id CID1 (B) Pub P1, Endpoint E2, Viewer V1 ==> Client id CID2 (C) Pub P2, Endpoint E1, No viewer ==> Client id CID3 (D) Pub P2, Endpoint E1, Viewer V1 ==> Client id CID3 or CID4 (E) Pub P2, Endpoint E1, Viewer V2 ==> Client id CID3 or CID4

The bug is about the CID for (D) and (E). Depending on the sequence of visits, the CID for (D) and (E) changes. See below:

If the sequence is (C) => (D) => (E), All the client ids are CID3. If the sequence is (D) => (C) => (D), (D) returns CID4 first, then (C) returns CID3 then (D) returns CID3.

In the second sequence, (D) returns CID4 first and returns CID3 on second visit.

avimehta avatar Feb 12 '16 23:02 avimehta

Closing as WAI

cramforce avatar Feb 15 '16 03:02 cramforce