I'm using amp-analytics with linkers - however, the variable substitution of CLIENT_ID(_) is different than when on a regular link.
For outbound links, I have the following setup:
{
linkers: {
enabled: true,
proxyOnly: false,
amp_analytics: {
ids: {
cid: 'CLIENT_ID(_)',
clientId: 'clientId(_)',
},
destinationDomains: ['*.pinterdev.com', '*.pinterest.com', 'pinterest.com'],
},
},
};
I also have links in my document like this:
<a
className={css(styles.AnnotationPill__pillLink)}
href={link}
data-amp-replace="CLIENT_ID"
>
{annotation}
</a>
These produce different results - a sample outbound link will have the following properties:
{
"?amp_client_id": "amp-DBuTE-YADZ2S4e05_asrsw",
"mweb_unauth_id": "7d93de3c",
"amp_url": "https%3A%2F%2Fwww-dev-jdecaro.pinterdev.com%2Famp%2Fpin%2F666532813571229808%2F",
"amp_analytics": "1*1deef19*cid*YW1wLURCdVRFLVlBRFoyUzRlMDVfYXNyc3c.*cid2*YW1wLURCdVRFLVlBRFoyUzRlMDVfYXNyc3c.*clientId*Y2xpZW50SWQoXyk."
}
amp_client_id is amp-DBuTE-YADZ2S4e05_asrsw, and the parsed amp_analytics key has cid of YW1wLURCdVRFLVlBRFoyUzRlMDVfYXNyc3c, and clientId of Y2xpZW50SWQoXyk
Use amp-analytics with the linkers attribute (documentation here) and create an a tag with data-amp-replace of CLIENT_ID(_). Click on that link and look at the search params.
All
Latest - 2008150009001
Over to @zhouyx
Hi @jonluca, would you be able to provide a test page that exhibits this behavior? I am having trouble reproducing this bug on my end.
cid of YW1wLURCdVRFLVlBRFoyUzRlMDVfYXNyc3c
Hi @jonluca, this value that you are receiving is the correct CLIENT_ID (amp-DBuTE-YADZ2S4e05_asrsw); it is just encoded as per the linker format specified here. The linker feature will append the ids to the url as a query parameter, after encoding it partially.
If you are finding this value in the url, then you have two options:
馃う That would do it! Thanks!