Tracking behaviour in OneLence is influenced by the SDK lifecycle and the visitor’s consent state.
Understanding this lifecycle helps ensure that attribution signals, behavioural events, and conversion data are captured reliably.
SDK Initialization
Tracking begins when the SDK is initialized during application startup.
The initialization step:
- prepares attribution parameter detection
- establishes visitor identity handling
- configures automatic page view behaviour
- determines consent gating rules
The SDK should be initialized only once per application runtime.
Consent Gating Behaviour
Consent configuration controls whether tracking signals are allowed to persist and be transmitted. See Consent & Privacy Handling for more details.
Typical consent modes include:
- Immediate tracking — tracking starts as soon as the SDK initializes
- Deferred tracking — tracking waits until explicit consent is granted
- Auto-consent mode — tracking resumes only when previously granted consent is detected
When consent is not yet granted:
- attribution parameters may be temporarily held in memory
- visitor identifiers may not be persisted
- automatic page view events may be delayed
Once consent is granted, pending signals can be emitted and stored.
Runtime Consent Updates
Applications can update consent state dynamically based on user interaction.
For example:
Mark.setConsent('granted')
Updating consent at runtime allows:
- immediate activation of tracking after banner acceptance
- restoration of attribution continuity
- proper recording of subsequent conversion events
If consent is revoked, tracking should be halted to comply with privacy requirements.
Lifecycle Impact on Attribution Accuracy
Tracking lifecycle configuration directly affects measurement quality.
Incorrect consent timing can lead to:
- missing first-touch attribution signals
- fragmented visitor journeys
- delayed conversion visibility
Designing a clear consent flow and initializing the SDK early in the application lifecycle helps maintain consistent attribution insights.
