← All integration guides

HTML

Add Analytica to any static site with one script tag.

Install the tracker

Copy the tracker script into your page template before the closing body tag. Replace the project ID with the tracking ID shown in your dashboard. data-project-id and data-project-key are the same value. data-host and data-endpoint are the collector. data-api-host is the web origin used for flags, not the script URL and not the collector.

The tracker stores analytica:vid:{projectId} in localStorage and sends it as visitorId. identify() does not replace that id. Installing the script does not verify the project. It stays pending until a recent non-bot pageview, or a track event named analytica_install_test, arrives from an allowed origin. Onboarding polls that status. Exposure-backed experiments need this tracker, labeled v1.21 in the app, because it sends the visitor id.

<script
  async
  src="https://cdn.example.com/analytica.js"
  data-project-id="prj_your_site"
  data-host="https://collector.example.com"
  data-api-host="https://analytics.example.com"
></script>

Track custom events

Use the tracker queue for product events without adding cookies or personally identifying data.

Name events carefully — dashboard Goals with match type “event” count track events whose name equals the goal value (for example signup_completed).

window.analytica.push(["track", "signup_completed", {
  plan: "starter"
}]);

Path goals and funnels

Pageviews are enough for path-based goals and funnel steps. Create a goal or funnel step with match type “path” and value like /pricing or /checkout/success.