Google Analytics has been deemed illegal by the EU DPA. Undicat is a British company, operated fully on European infrastructure.

Advanced embed code settings

These are the advanced options we offer with our embed script. Our standard script installation (pasting a single line of code into your site) works great for most customers.

Change when the script is loaded

By default, our script is deferred, meaning our script loads once your HTML has finished loading. That means our script doesn’t affect your site load time or speed in any way (fast sites == better search engine rankings).

You can also swap out defer with async or just load it without either, but we don’t advise this. Instead, this is how our code should be most commonly used:

<script src="https://cdn.undicat.com/anyltics.js" api-key='SITE-KEY' defer></script>

Lite-mode

By default, we collect both page-views and other native events, such as clicks on links, buttons. This could easily increase the monthly event list, especialy for interaction-heavy sites (eg.: webshops).

That said, if you would like opt-out from the majority of the tracking, to focus on only the pageviews, you can enable lite-mode, using lite="true":

<script lite="true" src="https://cdn.undicat.com/anyltics.js" api-key='SITE-KEY' defer></script>

Disable only specific events

There is also an option to disable only specific types of events in the case you would like to collect the rest of the meta events.

If you wouldn't like to collect media events, (video or audio metrics), use disable-media="true":

<script disable-media="true" src="https://cdn.undicat.com/anyltics.js" api-key='SITE-KEY' defer></script>

In the case you don't need input events (eg.: search metrics, form updates), use disable-input="true":

<script disable-input="true" src="https://cdn.undicat.com/anyltics.js" api-key='SITE-KEY' defer></script>

You may also disable mouse click events, using disable-clicks="true"

<script disable-clicks="true" src="https://cdn.undicat.com/anyltics.js" api-key='SITE-KEY' defer></script>

Note: outbound links are tracked using mouse click events; turning out mouse clicks will turn out outbound event tracking.

Honouring Do Not Track (DNT)

By default, we collect data on every visitor to your website, regardless of them having DNT turned on or not. That's because Undicat is privacy-focused analytics, so nothing personal or identifiable is ever “tracked.” Plus, DNT is deprecated and no longer recommended by any browser.

That said, if you would like to honor DNT then update your code to include dnt="true":

<script dnt="true" src="https://cdn.undicat.com/anyltics.js" api-key='SITE-KEY' defer></script>

Change idle tracking timeout

By default, we collect attention information about the users, meaning that if they spend more than X seconds on the site without any action - with some exceptions, the user will be deemed inactive.

You may change this timeout using idle="50", which will set the idle timeout to 50 seconds:

<script idle="50" src="https://cdn.undicat.com/anyltics.js" api-key='SITE-KEY' defer></script>

Disable automatic tracking

By default, we collect a page view every time a visitor to your website loads a page with our script on it. If you don’t want that functionality, you can turn it off by using data-auto="false":

<script disable-auto="true" src="https://cdn.undicat.com/anyltics.js" api-key='SITE-KEY' defer></script>

Ignore canonicals

If there’s a canonical URL in place, we use it instead of the current URL. This is what most customers want, and it’s why it’s the default. If you want to use the current URL, even if there’s canonical (ignoring the canonical), then use ignore-cannonical="true":

<script ignore-cannonical="true" src="https://cdn.undicat.com/anyltics.js" api-key='SITE-KEY' defer></script>

Exclude domains

To exclude specific domains, but allow data to be collected from any other domain, use exclude-domains="example.com" and use a comma to separate multiple domains (no spaces in between the domains, just commas).

<script exclude-domains="localhost" src="https://cdn.undicat.com/anyltics.js" api-key='SITE-KEY' defer></script>

Note: by default excluded domains include all subdomains. To exclude only one subdomain include it in the list. To exclude all-but-one subdomain, add the desired subdomain in the domain whitelist

Whitelist domains

To send metrics from only a specific domain, use domain-whitelist="*example.com" and use a comma to separate multiple domains (no spaces in between the domains, just commas).

<script domain-whitelist="*.example.com" src="https://cdn.undicat.com/anyltics.js" api-key='SITE-KEY' defer></script>

Note: by default the whitelist only include first level domains. To match multiple either include them separately in the list or use a wildcard - *.example.com.

Environment

In the case of collecting usage metric from multiple environments, use environment="CUSTOM" to include the new event in the events.

<script environment="CUSTOM" src="https://cdn.undicat.com/anyltics.js" api-key='SITE-KEY' defer></script>

Note: by default all events will be collected using the PRODUCTION environment.

Release

In the case of your product is available in multiple releases, such as mobile applications, PWAs, include use release="v1.0.2"

This feature was tergetted towards our mobile users; you may want to check out our Using Mobile Analytics guide.

<script release="v1.0.2" src="https://cdn.undicat.com/anyltics.js" api-key='SITE-KEY' defer></script>

Note: by default no release information is collected

Language

You may want to set a custom language; in this case, use language="en-GB"

<script language="en-GB" src="https://cdn.undicat.com/anyltics.js" api-key='SITE-KEY' defer></script>

Note: by default we use the language of the browser

Single-page applications

If there’s no Undicat integration for your specific javascript system, you can use our generic SPA mode. Most applications use HTML5 History API, so the following code will typically work as-is. This code checks if the History API is available, and if it’s not, it falls back to listening to hash changes:

<script data-spa="auto" src="https://cdn.undicat.com/anyltics.js" api-key='SITE-KEY' defer></script>

Note: this code will still collect data about the initial load. See Disable automatic tracking above if you don’t want this.

If you want to explicitly say, “We are using only HTML5 History API” or “We only use hash-based routing,” you can use one of the following snippets:

<script data-spa="history" src="https://cdn.undicat.com/anyltics.js" api-key='SITE-KEY' defer></script>

Or:

<script data-spa="hash" src="https://cdn.undicat.com/anyltics.js" api-key='SITE-KEY' defer></script>

It’s unlikely that you’ll be using hash-based routing, but some people do (we do in our dashboard).

Client-side API functions

Some functions can be called once the Undicat script has been loaded.

For more advanced usecases, please visit our Advanced Script Methods guide

Track pageview

The typical use case for using this would be for someone handling routing manually themselves. Perhaps they have their own SPA / AJAX page loading or want more control over the data they send to Fathom.

undicat.pageview();

In addition to this, you can also go more complex and set your own parameters (when using this method, the canonical will not be used, as this becomes the source of truth):

undicat.pageview('https://yoursite.com/about');

Track an event

You can track an any event and it will automatically appear in the Undicat dashboard.

To track an event directly from html, just use data-event="your-event", where your-event is your custom event:

<button data-event="sign-up">Sign Up</button>

You may include any other event parameter, using the data-event-field="your-value", where field can be any string and your value can be any value:

<button data-event="sign-up" data-event-form="whitelist" data-event-component="footer">Sign Up</button>

You may also send custom events from Javascript:

// Event Code (string), The code you are given when you set-up the event
// Meta (JSON)
undicat.send('eventCode', meta);

Note: events starting with the native-* prefix are reserved for system events. Events, such as native-signup will throw a client-side error, visible in the web console.

eCommerce events

For more advanced, e-commerce related tracking please visit our e-commerce guide