DocsStart here

Add the script

Paste the Datacenter script tag into your site's head. Steps for plain HTML, WordPress, Shopify, Webflow, Squarespace, Wix and single page apps.

On this page

The script is one tag. In Private mode, the default, it sets no cookies and stores nothing in the browser.

HTML
<script defer data-site="shop.example.com" src="https://datacenter.so/s.js"></script>

Put it in the <head> of every page. data-site is the domain you added in Datacenter.

What the script does

  • Counts a pageview once the tab has been visible for 1.5 seconds.
  • Sends how long the page was visible when the visitor leaves.
  • Follows page changes in single page apps that use the History API.
  • Reads UTM tags and ad click ids (gclid, gbraid, wbraid, fbclid) from the landing address.
  • Does nothing in automated browsers that report navigator.webdriver.
  • Does nothing on localhost or 127.0.0.1, so a test on your own computer adds no visit. Open the published site to see your first one.

Step-by-step guides: Shopify, WordPress, Squarespace, Wix, Webflow, Framer, Google Tag Manager and any other site.

Plain HTML

Paste the tag inside <head> on each page, or in your shared header template.

WordPress

Use the Datacenter plugin: upload it, press Connect to Datacenter, and approve. It adds the tag and counts WooCommerce orders and new accounts, with nothing to paste. To paste the tag yourself instead, use your theme's header settings or a plugin that adds code to the head, and clear any page cache after you save.

Shopify

In the admin, open Online Store. Next to your theme, click ..., then Edit code. Open theme.liquid and paste the tag just before </head>. Full Shopify guide.

Webflow, Squarespace and Wix

Each has a site wide setting for custom code in the head. Paste the tag there and publish the site. Some of these builders only allow custom code on paid plans.

Single page apps

Load the tag once, in the main HTML file. The script listens for route changes and counts each one as a pageview. You do not need to call anything yourself.

Check it

Open your site, wait a few seconds, then look at the Live count in your dashboard. The same browser counts as one visitor per day.

Ad blockers

Some blockers stop analytics scripts by their address. To count those visits, serve the script from your own domain with a script proxy.

Something missing or wrong? Email hello@datacenter.so.