Datalayer FAQ

What is a datalayer?
A datalayer is a Javascript object that’s used to house information about the page and user. It is implemented to store contextual data you would like to pass from the page to other applications.

What are the benefits of a datalayer?
The utilization of a datalayer affords an efficient, agile approach to pass data from your website to other devices. It’s more stable and secure than individual ‘scraper’ commands, and is less susceptible to modifications rendered to the html markup. When using Salesforce Audience Studio, the datalayer grants a streamlined framework to send data about your site pages, users, and content into the data management platform.

What is expected on the client’s side to create and maintain a datalayer?
Clients will need to leverage their internal technical resources to define and populate a universal object on their sites, which carries all of the page and user-level information they would like to communicate to other applications. 

Once deployed, you can introduce new data points to the datalayer at any time, submit a ticket to Salesforce asking to activate that value, and within 48-hours you will see the attribute populate in the Audience Studio UI (presuming the daily population exceeds the 100-user threshold).

How do you recommend setting a UserID in the datalayer?
If the value is a hashed email in SHA256 format, we recommend naming the datalayer attribute "email_sha256". This will set you up for future success with the Marketing Cloud integration.

Generally, the userID attribute should be all lowercase in the datalayer which will allow it to appear in the first party usermatch report in the UI.

Datalayer Best Practices

  • Ensure elements within the object are unique and not duplicated
  • Do not include “krux_“ or “kx_“ in any of the datalayer object elements

What happens if the datalayer object is populated with new data after page load?
By default, Audience Studio datalayer collection tags are set to fire after content or page load. This means any data within the object that is deferred or populated by a subsequent user action — without reloading the page — will not be collected. To remedy, there are two options:

  1. If the page utilizes Ajax, an Ajax script is available within the Manage Sites menu that will redeploy the Audience Studio collection pixel following the load event and collect the new data

  2. The ControlTag can be reloaded on the page once the new data is set. Please note: this can have a significant impact on total data collection events (DCEs)
Have more questions? Submit a request


Please sign in to leave a comment.