ampproject / ampproject/amphtml

Pass cookie values to amp-analytics

Open
#35,743 1 comment 0 reactions 0 assignees View on GitHub
Stale Type: Feature Request
Dominant language
JavaScript
Stars
14.9k
Forks
4.1k
PR merge metrics
No merged PRs in 30d

Description

### Description

I'd like to pass a cookie value to our in house analytics platform.

One thought was just adding a new substitution variable that can be used in the url. This would be similar to how `clientId` works at the moment.

So ideally, we could do something like:

url: `https://inhousetracking.com/tracking?${ampCookie('cookieName')}`

### Alternatives Considered

There is a way to use linker and query params variables? But that's not really what we want

### Additional Context

_No response_

Contributor guide

Open the contributing guide

Research direction

Start by locating amp-analytics and the existing clientId substitution-variable handling; the issue proposes a similar URL variable for a named cookie. Confirm the intended cookie-name and value syntax with maintainers, then add coverage for cookie-backed URL substitution and verify existing analytics substitutions remain unchanged.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
analytics
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.