<body>
.<head>
. In this case, we recommend splitting our code into the following two snippets with the first snippet being implemented directly in your source code, after canonical URLs are defined in your header HTML.<head>
after canonical URLs are loaded because it is responsible for altering the headline text in your homepage template to display test variant headlines to your visitors.<body>
, or whenever your data layer is available with the necessary section & author or user subscriber status data.<body>
<head>
. For these sites, we also recommend implementing the above header snippet (containing our Headline Testing JS) separately in the <head>
after canonical URLs are loaded. The rest of our code can be called later in the page load sequence, whenever your preferred page data is available.noCookies
configuration variable to true for these pageviews only. As soon as the visitor provides consent by viewing an additional page of your site, your custom code should recognize the cookied user and no longer set the noCookies
variable in your Chartbeat snippet.<head>
for pageviews where the user has not yet provided consent to cookies. This way, you can still load this code for users who have already provided consent and our Headline Testing tool will still work for this user group.window.onload
or document.ready
event. Our new snippet loads chartbeat.js immediately, asynchronously. <body>
. We've since adjusted our default implementation to load our script early in the <head>
to ensure we capture brief user pageviews which end prior to page load completion.