Release: Anonymous Tracking - collect privacy-friendly anonymized user behavior data

Ivar Pruijn

With this release, you can now use Objectiv to collect privacy-friendly anonymized user behavior data, without setting any cookies. This means you’ll be able to get all the first-party user behavior data you need to improve your product, while being fully compliant with GDPR, CCPA and PECR.

The Tracker SDKs and backend Collector now support enabling anonymous mode. When this mode is enabled, all automatically gathered information gets anonymized:

  • Client-side, no cookies or any other storage will be set; and
  • Backend-side, all sensitive information is either hashed or discarded, such as the IP address and user-agent.

To be specific: in anonymous mode, an automatically generated identifier is used across the session’s requests for as long as the session lasts. If the user navigates away or refreshes/reloads the application, a new identifier will be generated, so they’re seen as a new user.

Of course you could still persist this identifier in some way and use it in multiple sessions, while still tracking PII anonymously. Data is stored first-party, in your own data store.

How to use it

Anonymous tracking can be configured client-side when creating a new Tracker instance, by setting the anonymous option (false by default), and also at runtime by invoking the setAnonymous method.

For example, when creating a Tracker instance:

import { ReactTracker } from '@objectiv/tracker-react';

const tracker = new ReactTracker({
applicationId: 'app-id',
endpoint: 'https://collector.app.dev',
anonymous: true
})

Most likely, you’ll want to implement a cookie banner to ask users permission to set a cookie, in order to persist their identifier across sessions and track some useful information like IP address & user-agent. See the documentation for a full example of a Vite + React application with such a cookie banner and anonymous tracking.

Below are two code examples for React to switch anonymous mode on or off, e.g. based on the user’s response to a cookie banner.

Via the useTracker() hook:

const tracker = useTracker();
tracker.setAnonymous(!cookieConsent);

Or via render-props from a Tracked Element, Location Wrapper or Tracked HOC:

<ContentContextWrapper id={'sub-content'}>
{(trackingContext) => (
<button onClick={() => trackingContext.tracker.setAnonymous(!cookieConsent)}>
{ cookieConsent ? 'Disable' : 'Enable' } Anonymous Mode
</button>
)}
</ContentContextWrapper>

How to get it

Upgrade your Tracker SDK to the latest version, available on NPM. To upgrade or install, follow instructions for your platform. You’ll also need to upgrade your Collector container.

Summarizing

With this release of anonymous mode, you can get all first-party user behavior data you need to improve your product, and be fully compliant with GDPR, CCPA and PECR. When this mode is enabled, no cookies are used, and all automatically gathered information gets anonymized. To get started, upgrade your Tracker SDK, and your Collector.

info

Office Hours

If you have any questions about this release or anything else, or if you just want to say 'Hi!' to team Objectiv, we have Office Hours every Thursday at 4pm CET, 10am EST that you can freely dial in to. If you're in a timezone that doesn’t fit well, just ping us on Slack and we'll send over an invite for a better moment.

Join the Office Hours

Try Objectiv

Get Objectiv Up - Try Objectiv on your local machine (takes 5 minutes)
Objectiv on GitHub - Check out the project and star us for future reference
Objectiv on Slack - Join the discussion or get help