Overview
Tracking behaviour can be gated by user consent.
This determines:
- when tracking begins
- whether a visitor identity is created
- whether attribution data is stored
If consent is not granted, tracking will not start.
This is a common reason why no signals appear during setup.
Consent Modes
Tracking behaviour is controlled using the require_consent option in Mark.init().
Mark.init({
require_consent: 'auto'
})
Available options
- false → tracking starts immediately
- true → tracking starts only after explicit consent
- 'auto' → requires stored granted consent and treats missing consent as denied
Default: false
Recommended for production: 'auto'
How Consent Affects Tracking
Before consent is granted
When consent is not available:
- tracking is paused
- no visitor ID is created
- attribution parameters are not stored
- events are not sent
This may appear as “tracking not working”, but is expected behaviour.
After consent is granted
Once consent is granted:
- tracking starts immediately
- visitor identity is created
- attribution data is captured
- events begin to appear in OneLence
Updating Consent State
If your site uses a cookie banner or consent manager, update the tracking state when the user makes a choice.
<script>
Mark.setConsent('granted')
</script>
or
<script>
Mark.setConsent('denied')
</script>
This should be triggered when the user accepts or rejects tracking in your consent banner.
Typical Integration Flow
A standard production setup:
- SDK initializes with
require_consent: 'auto' - visitor opens the site → tracking is paused
- visitor accepts cookies →
setConsent('granted')is triggered - tracking starts from that moment
Common Mistakes
Consent not granted during testing
Symptoms:
- no page views appear
- visitor ID is undefined
- attribution data missing
Fix:
- accept the consent banner during testing
- or temporarily set
require_consent: falsefor testing
Consent signal not connected
Symptoms:
- consent banner appears, but tracking never starts
Fix:
- ensure your consent tool triggers
Mark.setConsent('granted') - check for JavaScript errors blocking execution
Using incorrect consent mode
Common issues:
- using true without calling
setConsent() - using
'auto'without stored consent state
Fix:
- use
'auto'in production - ensure consent state is stored and accessible
When to Use Each Mode
- use
false→ local testing or internal environments - use
'auto'→ production websites with consent banners - use
true→ strict setups requiring full manual control
Debugging Consent Behaviour
If tracking does not start:
- check browser console for errors
- confirm consent state is updated correctly
- test in a private browser session
- disable ad blockers during testing
Summary
Consent determines when tracking becomes active.
If consent is not granted, tracking will not start.
Most missing data issues during setup are caused by consent blocking rather than integration errors.
