Note: We are in the process of working with Google to update the AMP integration in preparation for Google's intent to deprecate delayed fetch for DoubleClick on March 28, 2018.
Please refer to the following article for transition details.
Salesforce Audience Studio Analytics Support for AMP
Audience Studio is collaborating with Google to support the Accelerated Mobile Pages Project (AMP), which is intended to optimize web page loads on mobile devices.
The AMP approach seeks to optimize asset load performance on pages. To achieve this, it restricts the publisher's ability to run their JavaScript, or those of their data partners such as Audience Studio. This necessitates changes to data collection methods for audience analytics, as well as segment-based ad targeting. Please note that in some cases, the restrictions imposed by AMP may impact some value-added Audience Studio capabilities that are available on non-AMP pages.
This article describes how Audience Studio supports AMP for the purposes of analytics and segment-based ad display. Note that as the specification continues to evolve, Audience Studio is working with Google's AMP Project team to represent our publisher clients' interests in monetizing their data in an open, privacy-safe ecosystem.
- Implementing AMP Analytics
- Implementing Consent
- About User Matching
- Implementing AMP Ads
- Additional Implementation Support
- Need Help?
Implementing AMP Analytics
The AMP project provides the amp-analytics
extension component to track and measure activity on AMP HTML documents. Publishers can enable this by adding the amp-analytics
tag to their pages. Please refer to the amp-analytics
documentation provided by the AMP project for description of the component.
Please note that in standard (i.e. non-AMP) web environments, Audience Studio collects a complete set of client specific page and behavioral data through the implementation of native JavaScript in Audience Studio Control Tag, and the use of Audience Studio Data Transfer Code (DTC). To match an equivalent data set for AMP enabled pages, publishers are required to construct and maintain the amp-analytics
component to match their specific DTC requirements. This can be achieved through the combination of the vars
attribute to specify page specific key-value pairs, and augmented by the extraUrlParams
attribute of the amp-analytics
tag.
The following are the implementation details required for integrating AMP pages with Audience Studio:
- Ensure you have enabled the
amp-analytics
extension by placing the following code immediately before the</head>
tag:<script async custom-element="amp-analytics" src="https://cdn.ampproject.org/v0/amp-analytics-0.1.js"></script>
- Add an
amp-analytics
tag to activate the Audience Studio Analytics extension (the text SAMPLE below would be your Audience Studio Config ID):<amp-analytics type="krux" config="https://cdn.krxd.net/controltag/amp/SAMPLE.json"> <script type="application/json"> { "extraUrlParams": { "user.status": "developer", "page.keywords": "amp, mobile, examples" } } </script> </amp-analytics>
- Publisher specific variables and user data must be provided using the
extraUrlParams
attribute. Variables prefixed with 'user.
' are user attributes and those prefixed with 'page.
' are page attributes. Any variable not prefixed with either 'user.
' or 'page.
' will not be properly collected.
If you require first party attributes to be sent from your AMP pages to Audience Studio, please contact the Salesforce Audience Studio Solutions team at kruxhelp@krux.com, to verify which specific attributes are required to ensure that data collection from AMP pages concur with the collection from your standard web-page deployments.
Implementing Consent
Collecting consent from your users into Audience Studio is just as important on AMP pages as it is on your non-AMP desktop sites and mobile apps.
Currently there are two ways to implement consent collection from AMP pages into Audience Studio:
1) Consider using the code example below.
When the user consents via the page's amp-user-notification, the amp-analytics tag becomes visible and will fire both the data collection pixel as well as consent set.
Please adjust the code below as required.
Particularly:
- Use your Audience Studio short org id (contact Services or Support if unsure)
- Use “extraUrlParams” section to collect desired page/user attributes as per AMP implementation documentation, subject to relevant consent
- Set the 6 consent flags as required, to reflect the consent user gives
<amp-analytics type="krux"
data-consent-notification-id="amp-user-notification-privacy"
config = "https://cdn.krxd.net/controltag/amp/<YOUR_CONF_ID>.json">
<script type = "application/json"> {
"extraUrlParams": {
// PASS REQUIRED PAGE/USER ATTRIBUTES TO BE COLLECTED ON THIS PAGE
// AS PER AMP IMPLEMENTATION DOCUMENTATION
// https://konsole.zendesk.com/hc/en-us/articles/216596608-AMP-Integration-Guide
},
"triggers": {
"setConsent": {
"on": "visible",
"request": "setConsent",
"vars": {
"dc": 0,
"al": 0,
"tg": 0,
"cd": 0,
"sh": 0,
"re": 0
}
}
}
}
</script>
</amp-analytics>
2) Develop your own AMP compatible script to extract the Audience Studio user KUID (from browser localstorage/cookie) and create/trigger the /consent/set/ method of Audience Studio Consent API using appropriate consent flags and settings. You will also need your long (36 characters) org id, contact Support or Services if unsure.
For either case, here's an example of a successful /consent/set/ API call, setting data collection, analytics and targeting to YES and cross device, sharing and reidentification to NO:
https://consumer.krxd.net/consent/set/<YOUR_LONG_ORG_ID>?idt=device&dt=kxcookie&dc=1&al=1&tg=1&cd=0&sh=0&re=0&idv=<USER_KUID>
About User Matching
Normally within a standard desktop or mobile web site, we can have user match pixels fire through the Control Tags on these pages and collect the matches necessary for when you push segments in Audience Studio to activation partners or receive data from your 3rd party data providers. With AMP pages, this cannot happen since our Control Tags are JavaScript and JavaScript is not allowed on AMP pages.
Implementing AMP Ads
AMP ads need to be served via the amp-ad tag to enable Audience Studio targeting via Fast Fetch. Since amp-ad tags were previously required for Audience Studio targeting to be enabled via Delayed Fetch, we will not provide details on the initial setup for amp-ad tags. The following instructions assume that amp-ad tags are already present on the publisher's AMP webpages:
First, contact the Salesforce Audience Studio Solutions team at kruxhelp@krux.com to get the Organization ID for your Audience Studio instance. This Organization ID will be used to ensure we are fetching segments for your organization. When contacting Audience Studio Solutions, please be sure to ask for the Organization ID used for AMP tags, as we have multiple forms of the Organization ID. Please confirm that the Organization ID provided consists of 30 alphanumeric characters separated by four dashes, and looks similar to the following:
abcd1234-ef56-ab78-cd90-efghij123456
Then, locate all instances of amp-ad tags on your AMP webpages. They should look similar to the following, and have required height
, width
, and type
parameters (your specific implementation may have more):
<amp-ad width=300
height=250
type="foo">
...
</amp-ad>
For each amp-ad tag, we will be adding a new attribute called rtc-config
and a URL that will fetch the DFP targeting object from Audience Studio. If the rtc-config
attribute is already present on your amp-ad tags, please do not add the attribute a second time. Instead, you should add our URL to your existing list of URLs. Please keep in mind that AMP allows a maximum of 3 URLs to be configured per amp-ad tag. Two examples are provided below.
Example 1: Adding the rtc-config attribute and the Audience Studio URL
If your setup looks like the following, and does not already have the rtc-config
attribute:
<amp-ad width=300
height=250
type="foo">
...
</amp-ad>
Add the rtc-config
attribute with our URL as shown in the code snippet below. Please replace ORGANIZATION_ID
with the Audience Studio provided Organization ID, replace REPLACE_SEGS
with the DFP targeting key you want to use for Audience Studio segments, and replace REPLACE_ID
with the DFP targeting key you want to use for the Audience Studio global user identifier.
<amp-ad width=300
height=250
type="foo"
rtc-config='{
"urls": [
"https://cdn.krxd.net/userdata/v2/amp/ORGANIZATION_ID?segments_key=REPLACE_SEGS&kuid_key=REPLACE_ID"
]
}'>
...
</amp-ad>
The following is one possible way of configuring this (using a fake Organization ID):
<amp-ad width=300
height=250
type="foo"
rtc-config='{
"urls": [
"https://cdn.krxd.net/userdata/v2/amp/abcd1234-ef56-ab78-cd90-efghij123456?segments_key=kxsg&kuid_key=kuid"
]
}'>
...
</amp-ad>
Example 2: ADDING the Audience Studio URL to your existing list of urls
If your setup looks like the following, and you already have rtc-config
attribute:
<amp-ad width=300
height=250
type="foo"
rtc-config='{
"urls": [
"https://www.AmpPublisher.biz/A",
"https://www.amptgt.biz/B?d=START&vht=V_HT&vwt=V_WT"
]
}'>
...
</amp-ad>
Add our URL as shown in the code snippet below. Please replace ORGANIZATION_ID
with the Audience Studio provided Organization ID, replace REPLACE_SEGS
with the DFP targeting key you want to use for Audience Studio segments, and replace REPLACE_ID
with the DFP targeting key you want to use for the Audience Studio global user identifier.
<amp-ad width=300
height=250
type="foo"
rtc-config='{
"urls": [
"https://www.AmpPublisher.biz/A",
"https://www.amptgt.biz/B?d=START&vht=V_HT&vwt=V_WT",
"https://cdn.krxd.net/userdata/v2/amp/ORGANIZATION_ID?segments_key=REPLACE_SEGS&kuid_key=REPLACE_ID"
]
}'>
...
</amp-ad>
Validating Audience Studio Targeting on AMP Webpages
Open a testing page provided by the client in Google Chrome and open Dev Tools (command-option-i).
- Click the “Toggle device toolbar” icon to get the page into a mode where AMP page will serve. Reload the page to make sure the AMP page has served.
- Go to the elements tab of Dev Tools.
- Search (command-f) for “<amp-ad”, this should get you to the amp-ad tags.
- Confirm the amp-ad tags are configured as described in the implementation guide. The most important thing to check for is the presence of our userdata URL in the rtc-config. There might be some backslashes in the URL because the browser escapes certain characters, but that is fine.
Confirm that the requests to Audience Studio are firing as expected
- Go to the network tab of Dev Tools.
- Filter the requests for “krxd.net/userdata/v2/amp”.
- Click on one of the requests.
- Go to the response tab of the panel that pops up.
- Confirm that the
kuid
is returned using the targeting key as specified in the implementation guide. If your current user is a member of segments for the organization, then you should also see segments using the configured targeting key (kxsg
by default).
Confirm that targeting is set on the ad slots
- Go to the network tab of Dev Tools.
- Filter the requests for “doubleclick.net/gampad/”.
- Click on one of the requests.
- Go to the headers tab of the panel that pops up.
- Look for the
scp
parameter in the “Query String Parameters” section. Thekuid
and any segments returned from the server should be present in the following format with whatever other targeting parameters the website is setting on the slot (assuming the targeting keys arekuid
andkxsg
):kuid=abcdef&kxsg=seg1,seg2,seg3
If the site passes the above tests, then the publisher's site is configured properly.
Additional Implementation Support
Audience Studio fully recognizes that while the adoption of AMP improves page performance on mobile devices, it creates additional burden for the publisher to create and maintain the AMP specific page infrastructure required to ensure data collection integrity and segment based ad delivery. The publisher is responsible for replicating their existing data transfer infrastructure for AMP pages, and the deployment of the custom iframe
for ad delivery, as described here. In addition, it is strongly suggested that the implementation be verified with Audience Studio to ensure accurate data collection, analysis and ad display.
Please note that Audience Studio is fully committed to supporting publishers' monetization strategies, and if requested can provide publisher specific consulting and implementation and verification services for AMP ad and analytics when requested. Such requests will be treated as Audience Studio Change Orders and additional fees may apply.
Need Help?
If you need help with integrating AMP Analytics with Audience Studio, don't hesitate to contact the Salesforce Audience Studio Solutions team at kruxhelp@krux.com.
0 Comments