Local development

On localhost the script sends nothing, so development doesn't skew your stats. Two steps turn tracking on there.

Replace YOUR_SITE_ID with your site ID in Datrika. Copy the script with the ID filled in from your site settings, on the General tab.

Turn on tracking

The script switches itself off on localhost, 127.0.0.1 and .local domains. To test the installation locally, do both:

  1. Add the data-dev attribute to the script, whether you put it in index.html or in the Script component in Next.js.
  2. In your site settings on the General tab, add the address your site runs on locally, such as localhost, to Additional domains.
<script defer
  src="https://cdn.datrika.app/da.js"
  data-datrika
  data-dev
  data-site-id="YOUR_SITE_ID">
</script>