Amp-ad: include client_id macro into amp-ad
We would like to have client_id accessible inside our amp-ads through client_id macro, the same as we do it with amp-analytics component: (https://github.com/ampproject/amphtml/blob/master/spec/amp-var-substitutions.md#client-id).
Currently it is implemented for amp-list, but not for amp-ad. We tried to include amp-ads inside amp-list, but it's not working.
In the end we would like to get something like this, so that client-id will be assessable in amp-ads even when they are served via Google CDN:

By client_id we mean not PPID that is used in DFP, but the userId that we set as a cookie by amp-analytics script
Another note from my side - this is not about doubleclick or any adnetwork specific features, just about enabling the client_id macro besides amp-analytics and links also for amp-ad, which doesn't seem to work right now.
Doubleclick extension already sends CLIENT_ID(AMP_ECID_GOOGLE) in the ad request.
https://github.com/ampproject/amphtml/blob/3b5035c5ab38ee550170308b33932187f64c1d13/ads/google/a4a/utils.js#L276-L279
Do you mean that you want to access all CLIENT_ID?
/cc @keithwrightbos
For other ad networks integrated using a cross-origin iframe, clientId is available through the context API: https://github.com/ampproject/amphtml/blob/master/ads/README.md#available-information-to-the-ad
Amazing info, thanks a lot! This will help with a couple usecases (e.g. might make the Taboola case we discussed offline at least easier), but it will not help with cases where a publisher wants to push their own user ids into an ad network - for this the website owner would need to be able to use their own scope for the client_id instead of the one of the ad network.
@martinschierle that makes sense. Probably AMP can provide full macro expansion here.
the json attribute is a doubleclick only feature, @keithwrightbos for input from doubleclick's point of view. Do publishers pass along cookie values in ad requests on non-AMP pages?
Is there any update here? We have a couple monetization usecases which seem impacted by this?
We discussed offline a bit more. It seems if our AMP RTC mechanism is used, it will expand clientID macros there, so that it can populate back into ad manager key-values. More docs here:
https://github.com/ampproject/amphtml/blob/master/extensions/amp-ad-network-doubleclick-impl/doubleclick-rtc.md
@gembarguk I think this should solve your usecase?
@martinschierle Thank you, we are already using RTC, but I didn't find clientID among available macros there...
Hi, @martinschierle That would also solve a similar use-case I am having trouble with. Could you confirm that CLIENTID macro will be added in any time soon? I tried this week using it and it doesn't work - also it isn't listed in the RTC documentation. What we have there is the ADCID, which doesn't really solve my particular issue.
Hi folks,
We have received another request for this feature to be available. It's not uncommon for publishers to pass these kind of values to ad-servers, is there anything we can do to re-prioritize this request?
In the meantime, having some workaround could be of help.
Thanks.
cc // @kbarneyforbes @martinschierle
Have there been any updates with this? We have been trying to use client_id in amp-ad for targeting.
@jeffjose to chime in.
We have discussed with the Doubleclick team are now planning on implementing this feature as soon as time permits.
is the plan to expand variables within the doubleclick jsonattribute? OR it will be applied to all data- attributes?
The idea was just to do the json attribute, do you think it would be better to change the scope?
I don't have a preference. asked because the requirement was not clear to me. Thanks for the clarification.
We are expecting to use it in the json attribute. Something like
<amp-ad height="251" width="321" type="doubleclick" data-block-on-consent data-slot="/7175/fdcmobile/article-amp/topline/default/standard" data-multi-size="321x251,300x250,320x50,300x50,1x1,300x251" data-multi-size-validation="false" rtc-config="{"vendors": {"medianet": {"CID": "8CU66O230"}, "aps": {"PUB_ID": "3038", "PARAMS": {"amp": "1"}}}}" json="{"targeting":{"amp":"true","author":"sarahhansen","channel":"money","section":"money:markets","type":"forbesstaff","es":"stocks,coronaVirus","badges":"breaking-news","mobilex":"0","fvid":"${clientId}","pos":"mobilerec","templatetype":"topline","swimlane":"","specialslot":"","id":"blogAndPostId/blog/post/5866-5ebd88effa7dab0006fe6109","brand":"","strnativekey":"13b84c32"}}"></amp-ad>
@kbarneyforbes I just noticed your example has the CID in rtc-config. My plan was to expand this macro in the json attributes targeting. Does this satisfy your use case?
Edit: never mind, I see it in targeting as well :)
Leaving this issue open until experiment is fully launched.
awesome, @calebcordry ! Has it been deployed? Do we have a documentation written for it? Thanks a lot!