文档
浏览文档

Install the Privatus Analytics tracker

Install the cookieless Privatus Analytics tracker with one script tag, set common options like auto events and Web Vitals, and find a guide for your platform.

查看 Markdown

Every install comes down to one script tag in the <head> of every page:

html
<script defer src="https://privatusanalytics.com/js/pa.js" data-site="pa_YOURSITEID"></script>
  • Replace pa_YOURSITEID with your site id from Site settings → Tracking. The snippet generator on that page builds the tag for you, including any options you switch on.
  • defer loads the script without blocking your page. The core script is a few kilobytes and sets no cookies.
  • Add options as data- attributes. The most common:
You want to… Add
Track outbound links, downloads, forms and 404s automatically data-modules="engage,auto"
Measure Web Vitals data-modules="engage,vitals"
Track a hash-routed single-page app data-spa="hash"
Send pageviews yourself data-manual="true"
Skip admin pages data-exclude="/admin/*"

The full list is in the attribute reference.

Warning: Setting data-modules replaces the default list. The engage module (time on page and scroll depth) is on only when you leave data-modules out or include engage in it.

Choose your platform#

Websites and site builders: HTML · WordPress · Shopify · Webflow · Squarespace · Wix · Framer · Ghost

Tag managers: Google Tag Manager · Cloudflare Zaraz

Frameworks: Next.js · Nuxt · React · Vue · SvelteKit · Astro · Remix · Angular

Static site generators: Hugo · Jekyll · Eleventy · Docusaurus

Other: AMP · No-JavaScript pixel · Electron and browser extensions · Server-side

After installing#

Verify the installation. If nothing arrives, work through No data.

Add the analytics script to an HTML site

Add privacy-friendly analytics to a hand-written or server-rendered HTML site with one script tag, turn on engagement and auto events, and track custom events.

Install Privatus Analytics on WordPress

Install the Privatus Analytics WordPress plugin or add the snippet to your theme, exclude admins, track WooCommerce purchases and add an opt-out shortcode.

Install Privatus Analytics on Shopify

Add cookieless analytics to your Shopify store with the app embed or theme code, then track checkout purchases and revenue with a Shopify custom pixel.

Add Privatus Analytics to Webflow

Add privacy-friendly analytics to Webflow through site-wide custom code, handle your webflow.io staging domain and track events with custom attributes.

Add Privatus Analytics to Squarespace

Add cookieless analytics to Squarespace with header code injection, and track purchases with revenue from the Order Status Page without sending order details.

Add Privatus Analytics to Wix

Add privacy-friendly analytics to a Wix site as custom code in the head, count page navigations once and set the code type to Essential for your consent banner.

Add Privatus Analytics to Framer

Add cookieless analytics to a Framer site through custom code, track single-page navigation automatically and count clicks with a data-privatus-event attribute.

Add Privatus Analytics to Ghost

Add privacy-friendly analytics to a Ghost site through code injection, and count member and newsletter signups as an event without sending email addresses.

Install Privatus Analytics with Google Tag Manager

Load the Privatus Analytics tracker from a Google Tag Manager Custom HTML tag, set consent settings, send events from GTM triggers and avoid double counting.

Load Privatus Analytics with Cloudflare Zaraz

Load the Privatus Analytics tracker through Cloudflare Zaraz with a Custom HTML tool, handle Zaraz single-page app support and send events from your site.

Add Privatus Analytics to Next.js

Add cookieless analytics to Next.js with @privatus/next or next/script, for the App or Pages Router, with server-side events.

Add Privatus Analytics to Nuxt

Add privacy-friendly analytics to a Nuxt app with the @privatus/nuxt module or a head script in nuxt.config, with route changes tracked automatically.

Add Privatus Analytics to a React app

Add cookieless analytics to a React single-page app built with Vite or Create React App, using the index.html snippet or the typed @privatus/tracker client.

Add Privatus Analytics to a Vue app

Add privacy-friendly analytics to a Vue 3 app with a snippet in index.html, track Vue Router history or hash navigation and send custom events from components.

Add Privatus Analytics to SvelteKit

Add cookieless analytics to a SvelteKit app in src/app.html, track client-side navigation automatically and send client and server-side events from actions.

Add Privatus Analytics to Astro

Add privacy-friendly analytics to an Astro site with the @privatus/astro integration or an is:inline script in your layout, with view transitions supported.

Add Privatus Analytics to Remix

Add cookieless analytics to Remix or React Router 7 framework mode in app/root.tsx, and track conversions from actions with the server-side ingest API.

Add Privatus Analytics to Angular

Add privacy-friendly analytics to an Angular app in src/index.html, handle hash location routing and track custom events from an injectable Angular service.

Add Privatus Analytics to Hugo

Add cookieless analytics to a Hugo site with a head partial that loads the tracker only in production builds, and keep your site id in the Hugo config.

Add Privatus Analytics to Jekyll

Add cookieless analytics to a Jekyll site in your head include, load it only in production builds and keep the site id in _config.yml, on GitHub Pages too.

Add Privatus Analytics to Eleventy (11ty)

Add cookieless analytics to an Eleventy (11ty) base layout, with a global data file so the tracker loads in production builds but not in eleventy --serve.

Add Privatus Analytics to Docusaurus

Add privacy-friendly analytics to a Docusaurus docs site with the scripts config in docusaurus.config.js, and track docs feedback as custom events.

Track AMP pages with Privatus Analytics

Count pageviews on AMP pages with amp-analytics and the Privatus Analytics pixel endpoint, keep the referrer and report pages under your own domain.

No-JavaScript tracking pixel

Count pageviews without JavaScript using a 1×1 tracking pixel, with its parameters for page URL and referrer and its limits: pageviews only, no events.

Analytics for Electron apps and browser extensions

Count screens and events in Electron apps and browser extensions by posting to the collection endpoint with virtual URLs, without creating an identifier.