-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Closed
Labels
INTENT TO IMPLEMENTProposes implementation of a significant new feature. https://bit.ly/amp-contribute-codeProposes implementation of a significant new feature. https://bit.ly/amp-contribute-codeP2: SoonType: Feature RequestWG: analytics
Milestone
Description
We intend to implement a link decoration based solution for AMP pages to sync IDs across domains.
Design Goals
- Join user sessions when user navigates from AMP cache to publisher origin.
- Enable analytics vendors to provide a default configuration. This creates a simple mechanism by which publishers can turn this feature on/off.
- Easy upgrade path to a 3rd party cookie based solution on supported browsers.
There are three major pieces to this implementation
- Implement
CREATE_LINKER_PARAMmacro. - Implement
LINKER_PARAMmacro. - Implement
linkersconfig inamp-analytics
CREATE_LINKER_PARAM macro
The purpose of this macro will be to generate a query parameter in the following format:
<paramName>=<version>~<checksum>~<key1>~<value1>~<key2>~<value2>...
versionis a base64url numberfingerprint= UA + timezone + languagechecksum= base64url(CRC32(fingerprint + timestampRoundedInMin + kv pairs))
- All values are base64url encoded
- The Delimiter “~” was chosen because “.-_” are all used by base64url.
- Each vendor will have one URL param for all linkers they have.
The proposed API:
CREATE_LINKER_PARAM(vendorId, {
key1: value1,
key2: value2,
...
})Example:
linkerParams: {
_linker: CREATE_LINKER_PARAM(coolAnalytics, {
cid: CLIENT_ID(_foo),
qid: QUERY_PARAM(bar),
})
}LINKER_PARAM macro
This will read and decode the generated linker query parameter.
The proposed API:
LINKER_PARAM(vendorId, version, parameterName, allowedIntervalInMin)
Example:
writeCookies: {
_cookieName: "LINKER_PARAM(coolAnalytics, 2, _linker, 2)",
}
// returns the map of values passed into `CREATE_LINKER_PARAM`linkers amp-analytics config
Proposed config spec:
linkers: {
<name>: {
linkerParams: <Object>, // Key: param name, Value: string containing macros
sourceDomains: <Array<string>>, // Optional, default to Cache domain
destinationDomains: <Array<string>>, // Optional, default to canonical & source domains
},
...
}Example:
linkers: {
linkerA: {
linkerParams: {
_linker: CREATE_LINKER_PARAM('coolAnalytics', {
cid: CLIENT_ID(_foo),
qid: QUERY_PARAM(bar)
}),
sourceDomains: ["cdn.ampproject.org"],
destinationDomains: ["pub.com"],
}
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
INTENT TO IMPLEMENTProposes implementation of a significant new feature. https://bit.ly/amp-contribute-codeProposes implementation of a significant new feature. https://bit.ly/amp-contribute-codeP2: SoonType: Feature RequestWG: analytics