Antlytics logoAntlytics

Webflow

Webflow lets you add custom <head> code at the project level, so the snippet runs on every published page automatically.

Prerequisites

  • An Antlytics account and at least one site created in your dashboard
  • The tracking ID (UUID) from Settings → Tracking Snippet
  • A Webflow site on a paid hosting plan (custom code is not available on the free plan)

1. Open Project Settings → Custom Code

  1. In the Webflow Designer, open your project.
  2. Click the gear icon (Project Settings) in the top-left toolbar.
  3. Switch to the Custom Code tab.

2. Paste the snippet into Head Code

In the Head Code field, paste the following. Replace YOUR_SITE_ID with your tracking ID from the Antlytics dashboard:

<script>
(function(){
  var t="YOUR_SITE_ID",
      u="https://www.antlytics.com/api/ingest/pageview",
      k="ant_sid";
  function sid(){
    try{var s=sessionStorage.getItem(k);if(s)return s;
      s=crypto.randomUUID();sessionStorage.setItem(k,s);return s;}
    catch(e){return crypto.randomUUID();}
  }
  function utm(){
    try{var p=new URLSearchParams(location.search),o={};
      ["utm_source","utm_medium","utm_campaign","utm_term","utm_content"]
        .forEach(function(k){var v=p.get(k);if(v)o[k]=v;});
      return o;}
    catch(e){return {};}
  }
  function send(){
    fetch(u,{method:"POST",headers:{"Content-Type":"application/json"},
      keepalive:true,
      body:JSON.stringify(Object.assign(
        {tracking_id:t,pathname:location.pathname,
         referrer:document.referrer||undefined,session_id:sid()},
        utm()))});
  }
  send();
  window.addEventListener("popstate",send);
})();
</script>
  1. Click Save Changes.

3. Publish your site

Custom code changes only take effect after publishing. Click Publish in the Designer toolbar and publish to your Webflow subdomain or custom domain.

4. Verify data is flowing

Open your published Webflow site in a browser, then check the real-time count in your Antlytics dashboard. Data appears within seconds.

Troubleshooting

  • Custom code does not run in the Webflow Designer preview — you must publish first and test on the live URL.
  • Open the browser Network tab and confirm a POST to /api/ingest/pageview returns 200.
  • Confirm the tracking ID matches Settings → Tracking Snippet in your Antlytics dashboard.
  • Test in an incognito window if you have an ad blocker enabled, or set up the first-party proxy.

See Troubleshooting for more common issues.

Something missing? Get in touch and we will update these docs.