Configuration Variables

Configuration variables are set on the _sf_async_config object, and should be set between the CONFIGURATION START and CONFIGURATION END comments in the code.

Setting the Path

Chartbeat uses the raw path if not specified otherwise. Some sites use query parameters for other tracking purposes which can generate multiple copies of the same article in the Dashboard. To merge all these entries into one article you can override the path reported to Chartbeat by explictly setting the path variable.

The path must start with "/" (forward slash) and we highly recommend that you use a real path used to navigate to the page.

The value set for the path variable should be generated by your CMS or set to window.location.pathname, so that the same piece of code can be used on all pages.

Here are examples of setting the path variable:

_sf_async_config.path = "/directory/path";
_sf_async_config.path = cms.path.variable;
_sf_async_config.path = window.location.pathname;

Setting Page Titles

By default Chartbeat displays page titles using the <title> tag in your site's header.

However the title used for a page in Chartbeat can be overriden by setting the title variable. This can be useful in cases where all pages have a common prefix (e.g. "Publication Name: Story Title"), or when most pages share a common site title.

You can manually set the title variable or populate them dynamically by tying them to a variable in your CMS.

For example:

_sf_async_config.title = "Story Title";
_sf_async_config.title = cms.title.variable;

Your Domain's Dashboard

The domain variable serves as the name of your Chartbeat dashboard.

Configuring Subdomains:

Subdomains can be tracked in one of two ways:

  1. If you want to track a subdomain (e.g. "") within an existing Dashboard, simply copy the exact same code that is on your existing domain and add it to the HTML of the subdomain. In other words, you'll just need to make sure the domain variable is the name of the main dashboard you want to roll your subdomain into. To filter by a specific subdomain you can set up section tagging (Chartbeat Publishing only).
  2. If you want to track a subdomain separately from your other Dashboards, select "Add Site" on your Chartbeat settings page and follow on-site instructions.

Note: If you are adding a mobile subdomain, please refer to our Mobile Site Implementation for more information.

Your User ID

By default, the uid variable should be automatically set to your Chartbeat Account number when adding a new site. To retrieve the correct Chartbeat code for your account, head on over to It will look like this:

Please login to see your user id.

Canonical Links

Does your site use query parameters for tracking purposes (e.g. seeing people who came from an email newsletter)? Or does your site have multiple URL structures for the same page or article (e.g. vs

By default, Chartbeat will use either the raw path or canonical links (when available). We strongly encourage implementing canonical links to ensure consistent tracking of pages and to prevent seeing multiple listings of the same page in the Chartbeat Dashboard. If you're not familiar with canonical links, check out this helpful page from Google Support.

To utilize the canonical feature, you'll need to ensure that your site defines canonical links for each page (e.g. <link rel='canonical' href=''/>) and that the useCanonical variable is set to "true".

_sf_async_config.useCanonical = true;

If you are unable to or prefer not to use canonical links, you may alternatively set the path variable.

Note: Off-site canonical links, i.e. links pointing to other domains than the page is on, are not supported at the moment.

Section and Author Tagging

Note: Available for Chartbeat Publishing only.

In Chartbeat Publishing, you can filter your content by designated section or author value. To do this the sections and authors variables need to be set up. For example if a page is written by Bob Johnson and in the section US Politics, you would set:

_sf_async_config.sections = "US Politics";
_sf_async_config.authors = "Bob Johnson";

A page can have multiple sections and/or authors. Each variable accepts a comma separated list of values. For example if a page is co-written by Megan Summers and Kevin Smith and in Fashion and Fashion News, you would set:

_sf_async_config.sections = "Fashion,Fashion News";
_sf_async_config.authors = "Megan Summers,Kevin Smith";

The sections variable does not need to reflect real sections on the site, but should be thought of as groupings of pages that can be filtered on. Our suggestion is to populate these fields dynamically by tying them to a variable in your CMS which globally represents your sections and authors, so they can be easily changed.

_sf_async_config.sections = cms.section.variable;
_sf_async_config.authors =;

You can also populate these variables by using page metadata, a tag that already exists in your code, or part of your URL structure which contains these values.

Disabling Cookies

Customers who are subject to the EU e-Privacy Directive, or who would prefer not to use cookies, can set the noCookies variable to prevent Chartbeat from using cookies.

_sf_async_config.noCookies = true;

Note: By using Chartbeat without cookies, you will be unable to see Visitor Frequency, Conversion Quality, and Return Rates.