<head>
on any page where tests will be conducted. Our default code snippet utilizes the async attribute to load this script asynchronously: domain
• uid
• flickerControl
• useCanonical
& useCanonicalDomain
OR path
useCanonical
and useCanonicalDomain
variables to pull your page paths from the canonical URL element in your source code, these variables must be initialized after the rel=canonical
element loads in your site's header, and followed by the script tag which loads mab.js. Similarly, our code should load after your page <title>
tags near the top of the <head>
.<head>
in this order: rel=canonical
link element loadsasync
attributenoCookies
configuration variable set to true
to disable Chartbeat's first-party cookies, Headline and Image Testing will not work. See our alternative website integrations page for instructions on how to customize your Chartbeat tracking code to use our noCookies variable in a way that is compatible with homepage testing.<head>
tag).<head>
tag), after the rel="canonical"
link element in your HTML.<body>
, either by necessity of your tag manager platform or because your data layer is only available to initialize the section/author or subscriber variables later in the page load, you can load our testing code separately in the <head>
following the instructions below.<head>
after canonical URLs are loaded because it is responsible for altering the headlines and images in your homepage template to display test variants to your visitors, so this should happen before your CMS headlines and images become visible to the user to prevent "flicker" (more on flicker and how to prevent it in the next article of this guide).<body>
, or whenever your data layer is available with the necessary section and author or user subscriber status data.false
if your site does not utilize our recommended headline flicker control JavaScript detailed in a subsequent page of this guide. Set this variable to true
if your site does utilize our headline flicker control JavaScript.flickerControl
true
false
mydomain.com
in the mysub.domain.com article page Chartbeat code.topStorageDomain
mysite.com
data-src
and data-srcset
(for example, data-img-sm
, data-img-lg
), you will need to set this variable to list the names of these lazy load attributes so our code can detect and replace those image urls. This variable accepts multiple comma separated string values as shown in the example below.lazyLoadImageAttributes
data-img-sm
article
, so if your site uses only <article>
tags to encapsulate your headline/image <a>
tags, you do not need to include this variable in your Chartbeat code snippet. However, if your site uses any additional tags for different image/headline link positions on your homepage, each of those elements needs to be assigned to this configuration variable separated by commas, as shown in the example below.articleBlockSelector
article
section.item