How to get DUID with Google-AMP-Tracker-v2?

I’m trying to figure out how to enhance the data being sent to the collector i have configured.
there doesn’t seem to be a duid (domain user ID) being sent to it.

My JSON amp configuration is something like this:


“vars”: {
“collectorHost”: “<collector_url>”,
“appId”: “amp-ID”,
“userId”: “generatedguid”
},
“triggers”: {
“trackPageview”: {
“on”: “visible”,
“request”: “pageView”
},
“trackPagePings”: {
“on”: “timer”,
“request”: “pagePing”,
“timerSpec”: {
“interval”: 20,
“maxTimerLength”: 1800,
“immediate”: false,
“startSpec”: {
“on”: “visible”,
“selector”: “:root”
},
“stopSpec”: {
“on”: “hidden”,
“selector”: “:root”
}
}
}
}
… <closing tags…

In the main website this is something that is achieved with sp JS sdk, but with AMP i’m left scratching my head.
Does anyone know how to get around this or has any insightful documentation?
Help would be much appreciated

1 Like

Hi @Yoav_Ganbar,

The domain Userid is a value which is produced by the Javascript tracker setting a cookie. In this sense it’s specific to traditional web browsers.

The AMP tracker doesn’t quite have the same features as the JS tracker, because it’s an extension of the AMP project, and therefore is restricted to how that platform works and what it will allow a third party extension to do.

It doesn’t, for example, offer as stable a means of setting cookies, nor does it offer a means of generating a globally unique UUID. What it does offer is a unique user identifier in the AMP client ID.

Because of these quirks of how tracking in AMP works, the user identification strategy is different - we don’t expect a domain userid, because the platform doesn’t offer a means of replicating the function of the domain userid (similarly to how it doesn’t quite make sense to expect on when tracking in a mobile app).

v2 of the AMP tracker will attach an ‘AMP ID’ context to each event. It will contain the AMP client ID, the userid (if it’s set) and, if the user has navigated from a JS-tracked page which has the cross-domain-linker enabled, it will contain the domain userid for the previous page too. For journeys passing from AMP pages to JS-tracked pages, the AMP cross-domain linker will pass the AMP ID across, so it can be parsed from the querystring and decoded.

There’s some documentation on this here: https://github.com/snowplow/snowplow/wiki/Google-AMP-Tracker-v2#43-user-identification.

TL;DR: The amp client ID is ostensibly what you would use instead of a domain_userid, and the AMP ID context should offer you a mechanism to stitch user identity across platforms in data modeling - the strategy here is to match domain userids to AMP client IDs.

Hope that’s helpful!

2 Likes

Thanks Colm!
I’ll see how we can work with this.