ampproject / ampproject/amphtml
amp-analytics not setting cookies when using self-hosted runtime
- Dominant language
- JavaScript
- Stars
- 14.9k
- Forks
- 4.1k
- PR merge metrics
- No merged PRs in 30d
Description
### Description
amp-analytics not setting cookies when using self-hosted runtime
### Reproduction Steps
## Observed Behavior:
amp-analytics blocks setting cookies when using a self-hosted runtime.
1. Go to https://www.bedbathandbeyond.com/amp/wm-optimized/store/s/shower
2. Observe self-hosted runtime tag
3. 
4. Observe that "current == proxy" when using self-hosted runtime and checkOriginForSettingCookie() throws error.
5. 
6. Cookie setting error then leads to a cascade of linker tracking errors and malformed beacons.
7. 
## Expected Behavior:
amp-analytics sets cookies to track user journey. The page below is not using self-hosted runtime. Cookies work as expected with linker configurations and _ga cookie tracking.
https://www.bedbathandbeyond.com/amp/store/s/shower
### Relevant Logs
_No response_
### Browser(s) Affected
_No response_
### OS(s) Affected
_No response_
### Device(s) Affected
_No response_
### AMP Version Affected
012208242209000, 012109272305001
Contributor guide
Research direction
Reproduce the issue with the self-hosted and non-self-hosted Bed Bath & Beyond AMP URLs, then inspect checkOriginForSettingCookie() and the amp-analytics cookie/linker flow. Done means cookies are set with the self-hosted runtime and linker tracking no longer produces cascading errors or malformed beacons.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- analytics
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100