ampproject / ampproject/amphtml
Linker ID Issue: Device_ID on AMP not the same as Device_ID on non-Amp page
- Dominant language
- JavaScript
- Stars
- 14.9k
- Forks
- 4.1k
- PR merge metrics
- No merged PRs in 30d
Description
## What's the issue?
We're trying to track who completes, or doesn't complete, a subscription purchase when the funnel originates on AMP pages. We've been trying to implement a [Linker ID](https://github.com/ampproject/amphtml/blob/main/extensions/amp-analytics/linker-id-receiving.md#receiving-linker-params-on-amp-pages) so we can tie our events together - the flow is:
1. Reader lands on AMP page
2. Reader get prompted and clicks to Subscribe from an AMP page
3. Reader gets transitioned to slate.com to complete the purchase
4. Reader is transitioned back to AMP page to continue reading
More specifically:
When the user lands on the initial AMP page, there is a device_id sent with the request. When they click on the button that opens the non-AMP page, the reader_id is in the URL. That string is different than the device_id from the referring page.
Here's an example:
1. I go to https://dev.slate.com/human-interest/2021/03/this-article-is-always-paywalled.amp and see a device_id of "amp-9MF1hLSDGPvW5k6ax7M2Fg" in the request payload.
2. I click on the main button on the page and receive the modal with the URL - https://dev.slate.com/amp-plus?reader_id=amp-bGNhk9ecjlc4bJFoF3y_gA&url=https%3A%2F%2Fdev.slate.com%2Fhuman-interest%2F2021%2F03%2Fthis-article-is-always-paywalled.amp&_=0.9485922054171301&redirect_uri=https%3A%2F%2Fcdn.ampproject.org%2Fv0%2Famp-login-done-0.1.html%3Furl%3Dhttps%253A%252F%252Fdev.slate.com%252Fhuman-interest%252F2021%252F03%252Fthis-article-is-always-paywalled.amp
Here, the reader_id is different than the device_id from before. If I reinitialize AMP with that ID, we'll be tracking a different ID.
Further, we're integrating AMP directly. Our config looks like:
```
{
"vars": {
"apiKey": "{{ @root.locals.site.amplitudeApiKey }}"
},
"linkers": {
"enabled": true
},
"triggers": {{{ striptags (stringify __amplitudeDataAMP) }}}
}
```
## How do we reproduce the issue?
Here is a test AMP page: https://dev.slate.com/human-interest/2021/03/this-article-is-always-paywalled.amp
You can test signing in with the following credentials:
email: salomone.baquis+testuser1@slate.com
password: testuser1
## What browsers are affected?
All browsers.
## Which AMP version is affected?
Version 2104170104001
Contributor guide
Research direction
Start with the amp-analytics linker configuration and the linker-id-receiving.md guidance, then reproduce the mismatch using the linked test AMP page. Compare the initial device_id with the reader_id passed to the non-AMP URL and trace where each value is generated. Done means the relationship between the IDs is corrected or the expected linker behavior is clearly established.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- analytics, frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100