If you installed OneLence using the browser script snippet, you can adjust tracking behaviour by editing the configuration object inside Mark.init().
This section explains what each parameter means and when you may want to change it.
Default Installation Snippet
<script src="https://unpkg.com/@crelora/mark@latest/dist/browser.umd.js"></script>
<script>
Mark.init({
key: 'pk_your_publishable_key',
require_consent: false,
autocapture: { pageview: true },
site_id: 'your_site_id',
site_host: 'your-site-host'
});
</script>
Note: Only modify values inside the configuration object. Do not change the SDK script source.
In case you're logged in as an OneLence user, you can fetch real values and use the code directly for your integration.
Parameter Explanation
key
Your publishable tracking key generated in the OneLence dashboard. This connects events from your website to your workspace.
Always required.
require_consent
Controls whether tracking starts immediately or waits for visitor consent.
Common options:
false→ tracking starts immediatelytrue→ tracking starts only after consent'auto'→ recommended production mode
Typical use case: Enable consent mode if your site shows a cookie banner.
autocapture.pageview
Controls automatic page navigation tracking.
true→ track page visits automaticallyfalse→ manual tracking required
Typical use case: Keep enabled for marketing websites and SaaS onboarding flows.
site_id
Unique identifier of your registered site in OneLence.
Used for:
- associating events with the correct project
- multi-site tracking setups
- attribution audit clarity
Usually has already been set up during onboarding.
site_host
Domain name of the tracked site.
Used for:
- debugging event origins
- multi-domain attribution clarity
- white-label tracking scenarios
Example:
www.example.com. Usually has already been set up during onboarding.
Optional Parameters to Add
You may extend the snippet with additional options depending on your tracking needs.
Enable debug mode during setup
debug: true
Purpose:
- see tracking logs in browser console
- validate event sending
- test attribution capture
Recommended during installation testing.
Capture additional campaign parameters
capture_query_params: ['sub_id', 'affiliate_code']
Purpose:
- track partner or affiliate campaigns
- measure custom marketing experiments
- support influencer tracking links
Add when your campaigns use non-UTM identifiers.
Capture all campaign parameters
capture_all_query_params: true
Purpose:
- fast campaign experimentation
- early-stage growth setups
⚠️ Only enable if you understand privacy implications.
Exclude sensitive parameters
query_param_denylist: ['email', 'token', 'session_id']
Purpose:
- prevent storing personal data
- keep attribution dataset clean
Limit captured parameter size
max_captured_query_params: 20,
max_query_param_value_length: 200
Purpose:
- maintain predictable tracking payload size
- improve analytics performance
Complete Configuration Example
The example below shows how a fully customised browser tracking snippet may look after adding common advanced parameters.
<script src="https://unpkg.com/@crelora/mark@latest/dist/browser.umd.js"></script>
<script>
Mark.init({
key: 'pk_your_publishable_key',
// Consent behaviour
require_consent: false, // 'auto': stored consent | true: require consent | false: immediate tracking
// Automatic navigation tracking
autocapture: { pageview: true },
track_route_changes: true,
// Attribution parameter configuration
capture_query_params: ['affiliate_code', 'partner_id'],
query_param_denylist: ['email', 'token'],
max_captured_query_params: 20,
// Event enrichment
include_page_context: true,
// Debugging during setup
debug: true,
// Site association
site_id: 'your_site_id',
site_host: 'your-site-host'
});
</script>
This configuration:
- automatically tracks page visits and route changes
- captures selected affiliate campaign parameters
- prevents sensitive query values from being stored
- enriches events with page context
- enables console debugging during integration testing
You can simplify or extend this configuration depending on your tracking needs.
When Snippet Configuration is Not Enough
You should move to developer SDK configuration if you need:
- cross-domain attribution engineering
- backend conversion validation
- identity linking logic
- custom routing behaviour
- multi-tenant SaaS tracking
These advanced setups are explained in the next section.
