AMP Integration Guide

Salesforce DMP Analytics Support for AMP

Salesforce DMP 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 Salesforce DMP. 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 Salesforce DMP capabilities that are available on non-AMP pages.

This article describes how Salesforce DMP supports AMP for the purposes of analytics and segment-based ad display. Note that as the specification continues to evolve, Salesforce DMP 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

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, Salesforce DMP collects a complete set of client specific page and behavioral data through the implementation of native JavaScript in Salesforce DMP Control Tag, and the use of Salesforce DMP 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 Salesforce DMP:

  • 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 Salesforce DMP Analytics extension (the text SAMPLE below would be your Salesforce DMP 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.

Please contact the Salesforce DMP 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 AMP Ads

The AMP project provides the custom element, amp-ad, to load ads. It does not allow partner-provided JavaScript to run inside the AMP document. The AMP runtime loads an iframe from a different origin than the AMP document, and executes the partner's JavaScript in that iframe. The amp-ad implementation provides remote.html code to facilitate loading the iframe that is used to load ads. The incoming iframe configuration can also be processed to enhance the ad configuration. Salesforce DMP provides a modified remote.html function that utilizes this capability to render segment based ad targeting.

To implement Salesforce DMP segment targeted ads on AMP pages, please do the following:

  • Obtain the remote.html file provided by Salesforce DMP from https://cdn.krxd.net/amp/remote.html. Alternatively, the Salesforce DMP functionality can also be incorporated into your custom remote.html file as shown in the next section. Note that you need to host this file on your domain, and do not reference directly from the Salesforce DMP domain.
  • Add a third-party iframe to your AMP document that utilizes the remote.html code provided by Salesforce DMP.

    For example:

    <meta name="amp-3p-iframe-src" content="https://assets.your-domain.com/path/to/remote.html">
  • If you have multiple Salesforce DMP Config IDs, then you must have a different remote.html for each configuration. We recommend naming the file as follows: remote-SAMPLE.html where SAMPLE is your Salesforce DMP Config ID.

Incorporating Salesforce DMP Ad Support In A Custom remote.html

Salesforce DMP recognizes that publishers may choose to implement their own custom remote.html functionality. In that situation, the Salesforce DMP functionality can be included in your custom remote.html code as follows:

  • Add the following code immediately before the </head> tag:
    <script src="https://cdn.krxd.net/amp/remote.min.js">
    </script>
  • Change the draw3p call to (note SAMPLE should be replaced by your Salesforce DMP Config ID):
    draw3p(Krux.amp.withConfid("SAMPLE").interchange().draw3p());
    
    
  • Specifying the following options can further customize the call above:
    • withNamespace(ns) - a string containing the namespace, if the configuration is namespaced
    • withUserParam(param) - the name of the DFP targeting parameter to receive the Krux User ID (default: 'kuid')
    • withSegmentsParam(param) - the name of the DFP targeting parameter to receive the comma-separated list of segments (default: 'kxsg')
    • call(callback) - a function taking two parameters (config, done) which will be called by Salesforce DMP. The default simply calls done with the config.

      For example:

      draw3p(Krux.amp
        .withConfid("SAMPLE")
        .withNamespace("myns")
        .withUserParam("u")
        .withSegmentsParam("kxsegs")
        .interchange()
        .call(function(config, done) {
           // This is just an example, don’t do this in production.
           console.debug("Callback called!", config);
           done(config);
         }
      ).draw3p());

    Additional Implementation Support

    Salesforce DMP 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 Salesforce DMP to ensure accurate data collection, analysis and ad display.

    Please note that Salesforce DMP 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 Salesforce DMP Change Orders and additional fees may apply.

    Need Help?

    If you need help with integrating AMP Analytics with Salesforce DMP, don't hesitate to contact the Salesforce DMP Solutions team at kruxhelp@krux.com.

Have more questions? Submit a request

0 Comments

Article is closed for comments.
Powered by Zendesk