Documentation

Ahrefs Analytics

Last updated May 10, 2026

Ahrefs Web Analytics is a cookieless analytics product configured with a single project key. The ahrefsAnalytics() helper wires that key into the data-key attribute that Ahrefs' loader reads at startup.

Integrate with c15t

How c15t loads it

  • Category: measurement (Analytics)
  • Loads when: measurement consent is granted
  • On revocation: unloaded — c15t removes the script element from the DOM. Ahrefs Web Analytics is cookieless, so no client-side state needs clearing.

To run from a custom loader URL (for example a self-hosted proxy):

Once loaded, Ahrefs exposes its runtime API on window.AhrefsAnalytics. The c15t helper only models the serializable script configuration — calls to window.AhrefsAnalytics.sendEvent(...) happen in your application code as needed.

Tracking events in your app

c15t gates the Ahrefs Analytics script from loading until measurement consent is granted. Your application code that calls Ahrefs' runtime API (window.AhrefsAnalytics.sendEvent) is not automatically gated — window.AhrefsAnalytics does not exist until the script is loaded, so unguarded calls before consent throw.

Guard event calls by checking consent state. From React:

From plain JavaScript:

Types

AhrefsAnalyticsOptions

Loading…

Script

Loading…