We noticed that when we insert CLIENT_ID as a linker-param it is inserted as an invalid CLIENT_ID, and when we decode it it has no "amp-" prefix.
This is our Linker code:
"linkers": {
"linker": {
"ids": {
"clientId": "${clientId}",
},
"proxyOnly": false,
"destinationDomains": ["..."],
"enabled": true
}
}
This is the linker we get in our query string:
linker=1*tdm4sq*clientId*TzUxUXZmelI2Qk5WZ0JqMmRIeEFDSUJoa2tmLUw1SEFLR3lkeUs0eTFCOG9MUXNkS0JtR0habjlKQW5NLUVpYg..
the value of clienId after decoding:
O51QvfzR6BNVgBj2dHxACIBhkkf-L5HAKGydyK4y1B8oLQsdKBmGHZn9JAnM-Ei
This happens only if we come from an amp-cache page, if we come from an amp-non-cache page we get CLIENT_ID as expected:
"vars": {
"clientId": "CLIENT_ID(amp_id)"
}
result:

Also, we tried to save the clientId from linker as a cookie in a non-cached amp-page, the code in amp-tag:
cookies": {
"enabled": true,
"linker_amp_id": {
"value": "LINKER_PARAM(linker, clientId)"
}
The result:

So it looks like the creation of CLIENT_ID id fine but there is an issue with inserting it into Linker.
Thanks
Traiging to @calebcordry , feel free to re-assign 馃槃
@chcohen could you share an example page? It is expected to get a different value when on cache, as the amp runtime will ask the viewer to generate the client id, and it should be a random base64 string without the amp- prefix. Yours is a bit strange as I don't think the - should be in there.
@calebcordry Please use the following page:
If you press the link:
Link to non-AMP page (toggle enabled)
You will see something like this in the address bar:
https://resources-lab-elb-nv.xg4ken.com/tests/amp/non-amp-test-page.html?tid=KT-ALL-ENABLED&linker=11yphb8gclientIdQmE5aVlQZy0zMmwzYWFSUkRJVEk2YUptV2lNY3NPZlBwMF9uX3VnZ2dXTHN4SUI4aFU1eTN6S0tqbFNkM3o3Sg..channelClickId*MTIzNDU2Nzg5MDEyMzQ1Njc4OTA.
If you base64 decode the linker values you will get:
channelClickId: 12345678901234567890
clientId: Ba9iYPg-32l3aaRRDITI6aJmWiMcsOfPp0_n_ugggWLsxIB8hU5y3zKKjlSd3z7J
If however you use the following page (same page, not cached):
https://resources-lab-elb-nv.xg4ken.com/tests/amp/amp-test-page.html?gclid=12345678901234567890
and then press the link:
Link to non-AMP page (toggle enabled)
You will get something like this in the address bar:
https://resources-lab-elb-nv.xg4ken.com/tests/amp/non-amp-test-page.html?tid=KT-ALL-ENABLED&linker=11r9g3g4clientIdYW1wLUVsQktwLVYtbFpUYWt2WnQyeXhhSGc.channelClickId*MTIzNDU2Nzg5MDEyMzQ1Njc4OTA.
If you base64 decode the linker values now you will get:
channelClickId: 12345678901234567890
clientId: amp-ElBKp-V-lZTakvZt2yxaHg
@ifatgv4 This appears to be expected behavior, the cached page (with or without the viewer) will return a client id in a different format than the client id generated from a page served on your origin. Is this causing you some sort of problem?
cc/ @jeffjose
edit: some examples
amp-nlZsTNUKMALdu8xMOWS4gS5AcMJPMatx6zgJhHkNdxITbvMWN3q1ibF5msBUhcjWamp-ysnJfCSbFX5mwaiikTjF3wHOufF3vEpiACw5qpWMiHbt1YKYsgSrgDJL2YHXsaamc9X-PZhTwioKilio91UcaCJust to be clear, this is not specific to linker, but the way that client ids are minted in different contexts. Hopefully that helps.
@calebcordry If this is the expected behavior then I guess all is well :)
@calebcordry thanks for your answer, as @ifatgv4 said that's fine with us and you can close this issue :slightly_smiling_face:
Thanks for the update!
Most helpful comment
@calebcordry Please use the following page:
https://resources--lab--elb--nv-xg4ken-com.cdn.ampproject.org/c/s/resources-lab-elb-nv.xg4ken.com/tests/amp/amp-test-page.html?gclid=12345678901234567890
If you press the link:
Link to non-AMP page (toggle enabled)
You will see something like this in the address bar:
https://resources-lab-elb-nv.xg4ken.com/tests/amp/non-amp-test-page.html?tid=KT-ALL-ENABLED&linker=11yphb8gclientIdQmE5aVlQZy0zMmwzYWFSUkRJVEk2YUptV2lNY3NPZlBwMF9uX3VnZ2dXTHN4SUI4aFU1eTN6S0tqbFNkM3o3Sg..channelClickId*MTIzNDU2Nzg5MDEyMzQ1Njc4OTA.
If you base64 decode the linker values you will get:
channelClickId: 12345678901234567890
clientId: Ba9iYPg-32l3aaRRDITI6aJmWiMcsOfPp0_n_ugggWLsxIB8hU5y3zKKjlSd3z7J
If however you use the following page (same page, not cached):
https://resources-lab-elb-nv.xg4ken.com/tests/amp/amp-test-page.html?gclid=12345678901234567890
and then press the link:
Link to non-AMP page (toggle enabled)
You will get something like this in the address bar:
https://resources-lab-elb-nv.xg4ken.com/tests/amp/non-amp-test-page.html?tid=KT-ALL-ENABLED&linker=11r9g3g4clientIdYW1wLUVsQktwLVYtbFpUYWt2WnQyeXhhSGc.channelClickId*MTIzNDU2Nzg5MDEyMzQ1Njc4OTA.
If you base64 decode the linker values now you will get:
channelClickId: 12345678901234567890
clientId: amp-ElBKp-V-lZTakvZt2yxaHg