Anonymous & Consent Mode
Choose Anonymous Mode or Consent Mode when creating a project. This setting determines how the tracker starts. For a Consent project, the cookie-banner signal also determines which collection starts on the current page.
Anonymous Mode
An Anonymous project starts anonymous collection on page load without a consent signal. Session starts, page views and active time can be recorded. Unique visitor identifiers, new visitors and returning visitors require the corresponding Consent data.
Granting consent in a banner does not turn an Anonymous project into a Consent project. Change the project mode under Configuration in the manager, then check the updated Installation Guide.
Consent Mode
A Consent project uses your banner's decision:
| Decision on page load | Behaviour |
|---|---|
Granted: window.tiConsent is true | Consent collection starts. |
Denied: window.tiConsent is false | Anonymous collection starts. |
| No known decision yet | Regular page-view and session tracking waits. A separate previsit signal may be sent; it does not replace a regular page view or session start. |
Do not assume that anonymous collection is already running when no decision has been passed. Consent alone does not count as a visitor either: a recorded Consent session start with a valid visitor identifier is required.
Connect an existing cookie banner
Use this integration for a Consent project with an existing banner. Run this code when the relevant consent is granted:
window.tiConsent = true;
window.dispatchEvent(new Event('ti-consent-updated'));On rejection or withdrawal, pass:
window.tiConsent = false;
window.dispatchEvent(new Event('ti-consent-updated'));Set window.tiConsent first, then dispatch ti-consent-updated. Connect both cases to the corresponding actions in your banner. A banner that only emits its own events does not pass a decision to TrafficInsight.
Restore a saved decision
On every full page load, read the saved decision through your banner. Make window.tiConsent available before the TrafficInsight tracker starts wherever possible. If the tracker is already loaded but still inactive, pass the decision using the appropriate code above.
Do not automatically interpret a missing decision as either consent or rejection. The TrafficInsight cookie banner handles the integration when its provided initialisation is used; with an external banner, this is part of your integration.
Changes during a visit
The current tracker only starts Consent collection after a positive signal if the page was still inactive. If the page is already being tracked anonymously, a later positive signal does not switch that page to Consent collection. Visit another page or reload afterwards; the saved consent must be available there again.
Withdrawing consent during Consent collection stops regular tracking on the current page and removes the stored visitor and session identifiers. It does not immediately continue anonymously there. Anonymous collection can start on the next full page load with saved rejection.
Check the integration
Check these cases separately:
- Saved consent: Open the page again, record the first requests and check them in the app.
- Saved rejection: Open the page again; anonymous views can appear, but unique Consent visitors are not expected from those views.
- No decision yet: Use a test browser without a saved banner decision to check that regular tracking initially waits. After a decision, check the next page load.
- Withdrawal after consent: Check that ongoing Consent collection stops and saved rejection is passed on the next page load.
Test without a tracking exception enabled for this browser. The manager's installation check alone does not validate all these banner cases.
Check the data basis
Session starts, page views and unique visitor identifiers have different foundations. A Consent project can also contain anonymous events. Read the metric descriptions and notices about missing or partially available data alongside the values.
Read more: Visitors & sessions and Troubleshooting.