Privatrak

Documentation

Set up Privatrak, name what matters to you and read every report.

Watch the video seriesEight short videos covering the whole product, on YouTube.Opens in a new tab

Name things in your code

Name buttons, links and forms right in your site’s code, and send custom events for the things that aren’t clicks. Each name appears with its numbers on the Features page, with no rule to create.

Which way to use

  • A data-track attribute names a button, link or form. Privatrak records its clicks or form submissions under that name. Use it for anything people click.
  • The track() function sends a custom event. Use it when nothing is clicked, or when something should only count once it succeeded, such as a payment that went through or a video watched to the end.
  • The Element Picker names an element without any code. Use it when you can’t change the code, or when someone without access to it does the setup.

Name an element with data-track

Add data-track to the element. Its value becomes the name.

<button data-track="signup-cta">Sign up free</button>

Privatrak records every click on it, or every submission if it is a form. This also works with Interactions switched off under Settings › Tracker, so you can record only the elements you name.

A click on something inside the element, such as its icon or label, counts under the name too, up to 3 levels deep. You change the depth with data-walk-depth in the Tracker reference.

<a href="/pricing" data-track="pricing-card">
  <h3>Pro</h3>
  <span class="icon"></span>  <!-- a click here counts as pricing-card -->
</a>

Names are case-sensitive, so signup-cta and Signup-CTA are two features. Keep a name once it is in use, because a new name starts a new feature.

Add details with data-track-*

Add data-track- attributes to send details with each click. The part after data-track- becomes the detail’s name, so data-track-plan="pro" arrives as plan: pro.

<button
  data-track="upgrade"
  data-track-plan="pro"
  data-track-interval="yearly"
>
  Upgrade to Pro
</button>

A detail’s name can contain letters, numbers, hyphens, underscores and dots. So data-track-price-band="20-40" arrives as price-band: 20-40, and you can filter and break down by it like any other detail.

Put them on the same element as data-track. Details on any other element are not sent.

You filter and break down by details on the Events page and in Insights. When a detail is a number, such as the amount of an order, Insights also adds it up and averages it.

Send a custom event with track()

Call window.tracker.track() with a name, and details if you like:

// A sign-up that went through
window.tracker.track("signup-completed");

// With details
window.tracker.track("plan-upgraded", {
  plan: "pro",
  interval: "yearly"
});

// A purchase, with its amount as a number
window.tracker.track("purchase_complete", {
  total: 34.5
});

// A search that found nothing
window.tracker.track("search-no-results", {
  section: "help"
});
  • name (text, required): the event’s name. It appears on the Features page like a data-track name, so a click and a custom event can share one feature.
  • attrs (object, optional): details, each value as text or a number, such as plan: "pro" or total: 34.5. A number arrives in plain digits, so 34.50 arrives as 34.5 and 1e3 as 1000. 34.5 and "34.5" count as the same value.

Any other value, such as true, null, a list or NaN, is left out. The tracker names it in a warning in your browser’s console and sends the event with its other details.

Calls made before the tracker has started are not recorded. With the script tag from the Setup page, it starts as soon as it has loaded. Start the tracker yourself covers the other cases.

Check that it works

Open Events in Privatrak and choose Custom events under Event type to see your track() calls. Clicks named with data-track are listed as clicks, with their name in the Feature column. Each name also appears on the Features page.

Never send personal data

Privatrak stores names and text details exactly as you send them. Nothing is shortened or replaced on the way in.

Never send anything that points to one person. That means account or user IDs, email addresses, usernames, phone numbers, order numbers, and hashes of any of these. A hashed ID still belongs to one person, because the same person gets the same hash every time.

Privatrak doesn’t link one visitor’s days together. A value that stays the same for one person would link them again, and make everything that person did readable.

A simple test

  • Good: a value that many people share, such as plan: "pro", interval: "yearly", result: "error" or step: "3", or an amount, such as total: 34.5.
  • Bad: a value that belongs to one person, such as user_id: "4711", email: "ada@example.com", cart_id: "c_8f3a…" or uid_hash: "9b1c…".

To compare groups of people, send the group, not the member. plan: "pro" tells you what you want to know. account_id tells you nothing more and makes everyone traceable.

This applies to data-track names and details, to track() and to traits. The settings under Settings › Privacy protect page addresses, not names, details or traits.

Next steps

Name things in your code: data-track and custom events