ampproject / ampproject/amphtml
Make it possible to set cookies client-side
- Dominant language
- JavaScript
- Stars
- 14.9k
- Forks
- 4.1k
- PR merge metrics
- No merged PRs in 30d
Description
We hear this request often from more sophisticated and experienced AMP site creators - to allow reading and setting of cookies from ``, ``, and/or ``.
A common workaround is to set cookies server-side, which sometimes makes it necessary to create an API to set cookies. We want AMP to make things easier for developers, and unfortunately this server-side workaround makes the experience harder for developers and users alike.
Of course, being able to set cookies from `` would be nice too, and might cover these use cases. But it would be great to add this to older interactive components as, of course, they're far more widely adopted at the moment.
One possible format:
`on="tap:AMP.setCookie({currency: 'USD'})"`
/cc @mattwomple , @SimonHogstromRonbol, @nainar, @choumx
Contributor guide
Research direction
Start by reviewing the client-side entry points named in the issue: amp-bind, amp-list, amp-analytics, and amp-script. The issue does not identify files or tests, so first define the supported cookie behavior, API shape, and security constraints before determining what implementation and coverage would count as done.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100