You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/content/docs/1.guides/2.first-party.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -63,7 +63,7 @@ Every proxied script defaults to a privacy tier based on what level of anonymisa
63
63
|------|-------------------|---------|
64
64
|**Full**| IP, user agent, language, screen, timezone, hardware fingerprints | Meta Pixel, TikTok Pixel, X Pixel, Snapchat Pixel, Reddit Pixel, LinkedIn Insight Tag |
65
65
|**Heatmap-safe**| IP, language, hardware fingerprints (preserves screen and user agent for session replay) | Google Analytics, Microsoft Clarity, Hotjar |
66
-
|**IP only**| IP addresses anonymised to subnet level | Plausible, PostHog, Umami, Fathom, CF Web Analytics, Vercel Analytics, Rybbit, Databuddy, Matomo, Intercom, YouTube, Vimeo, Gravatar, Carbon Ads, Lemon Squeezy, Google AdSense |
66
+
|**IP only**| IP addresses anonymised to subnet level | Plausible, PostHog, Umami, Fathom, CF Web Analytics, Vercel Analytics, Rybbit, Databuddy, Matomo, Ahrefs Web Analytics, Intercom, YouTube, Vimeo, Gravatar, Carbon Ads, Lemon Squeezy, Google AdSense |
67
67
68
68
Sensitive headers (`cookie`, `authorization`) are **always** stripped regardless of tier.
69
69
@@ -323,7 +323,7 @@ These scripts are downloaded at build time, served from your domain, and have th
description: Use Ahrefs Web Analytics in your Nuxt app to track page views and custom events with a privacy-first, cookie-less analytics script.
4
+
links:
5
+
- label: Source
6
+
icon: i-simple-icons-github
7
+
to: https://github.com/nuxt/scripts/blob/main/packages/script/src/runtime/registry/ahrefs-analytics.ts
8
+
size: xs
9
+
---
10
+
11
+
[Ahrefs Web Analytics](https://ahrefs.com/web-analytics) is a privacy-first, cookie-less web analytics service from [Ahrefs](https://ahrefs.com) that tracks page views and custom events without sharing visitor data with third parties.
12
+
13
+
::script-stats
14
+
::
15
+
16
+
::script-docs
17
+
::
18
+
19
+
The composable comes with the following defaults:
20
+
-**Trigger: Client** Script will load when Nuxt is hydrating.
21
+
22
+
You can access the `AhrefsAnalytics` object as a proxy directly or await the `$script` promise to access the object. It's recommended to use the proxy for any void functions.
23
+
24
+
::code-group
25
+
26
+
```ts [Proxy]
27
+
const { proxy } =useScriptAhrefsAnalytics({
28
+
key: 'your-project-key',
29
+
})
30
+
function trackSignup() {
31
+
proxy.AhrefsAnalytics.sendEvent('signup', {
32
+
props: { plan: 'pro' },
33
+
})
34
+
}
35
+
```
36
+
37
+
```ts [onLoaded]
38
+
const { onLoaded } =useScriptAhrefsAnalytics({
39
+
key: 'your-project-key',
40
+
})
41
+
onLoaded(({ AhrefsAnalytics }) => {
42
+
AhrefsAnalytics.sendEvent('signup', {
43
+
props: { plan: 'pro' },
44
+
})
45
+
})
46
+
```
47
+
48
+
::
49
+
50
+
## SPA navigation
51
+
52
+
Ahrefs Analytics tracks single-page-app navigations natively: the loaded `analytics.js` patches `history.pushState` and listens for `popstate`, firing a fresh page-view whenever the URL changes. No extra configuration is needed for Nuxt route changes.
53
+
54
+
::script-types
55
+
::
56
+
57
+
## Example
58
+
59
+
Loading Ahrefs Web Analytics through `app.vue` when Nuxt is ready.
Copy file name to clipboardExpand all lines: packages/script/src/registry-types.json
+30Lines changed: 30 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,27 @@
1
1
{
2
2
"types": {
3
+
"ahrefs-analytics": [
4
+
{
5
+
"name": "AhrefsAnalyticsOptions",
6
+
"kind": "const",
7
+
"code": "export const AhrefsAnalyticsOptions = object({\n /**\n * Your Ahrefs Web Analytics project key. Set as the `data-key` attribute\n * on the loaded `analytics.js` script tag.\n * @see https://ahrefs.com/web-analytics\n */\n key: pipe(string(), minLength(1)),\n})"
8
+
},
9
+
{
10
+
"name": "AhrefsAnalyticsSendEventOptions",
11
+
"kind": "interface",
12
+
"code": "export interface AhrefsAnalyticsSendEventOptions {\n /** Custom dimensions sent under `props`. */\n props?: Record<string, string>\n /** Arbitrary metadata sent under `meta`. */\n meta?: Record<string, unknown>\n /** Optional callback invoked once the beacon request completes. */\n callback?: (result?: { status?: number }) => void\n}"
13
+
},
14
+
{
15
+
"name": "AhrefsAnalyticsInstance",
16
+
"kind": "interface",
17
+
"code": "export interface AhrefsAnalyticsInstance {\n /**\n * Manually send an event to Ahrefs Analytics. The script auto-fires\n * page-view events on initial load and on `history.pushState`/`popstate`,\n * so SPA navigations are tracked without calling this.\n */\n sendEvent: (name: string, options?: AhrefsAnalyticsSendEventOptions) => void\n}"
0 commit comments