Setup & Integration

Install On WordPress

Add the OneLence Mark SDK to your WordPress website to enable base tracking, visitor identification, and conversion measurement with minimal setup effort.

✅ Introducing OneLence Consent — for WordPress users, the easiest way to connect OneLence without manual code setup!

Visit this doc to learn how to setup via OneLence Consent in Wordpress.

For users look for other ways to install OneLence, please refer to the following content:

Install The SDK In WordPress

There are two common ways to load the Mark SDK across your entire WordPress website.

You can either add the SDK snippet directly to your theme files, or use a header script plugin.

HTML
<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>

Do Not copy the example values from this documentation, because the tracking key and site details shown here are for explanation only.

In case you're logged in as an OneLence user, you can fetch real values and use the code directly for your integration.

Choose the approach that best matches your workflow and technical confidence.

Option 1. Add The Snippet In header.php

This approach loads the SDK directly from your active theme.

  1. Open your WordPress admin dashboard.
  2. Navigate to Appearance → Theme File Editor.
  3. In the file list on the right side, locate and open header.php.
    Insert snippet into header.php file on wordpress
  4. Inside the <head> … </head> section, insert your Mark SDK snippet. Click Update File to save the changes.

Use the auto-generated snippet from your OneLence onboarding workflow (image below):

Setup via script snippet

This ensures the correct credentials such as key, site_id, and site_host are included.

After saving, the SDK will load on every page of your site.

Option 2. Add The Snippet Using A Header Script Plugin

If you prefer not to edit theme files directly, you can use plugins such as Code Snippets, WPCode, or Insert Headers and Footers.

  1. Open your header script plugin.
  2. Locate the Header or Header & Footer script section.
  3. Paste your Mark SDK snippet into the Header area.

Add snippet to Header via Code Snippets 4. Click Save Changes.

This will inject the SDK globally across the site.

Method B. Create A Dedicated Snippet

Some plugins allow creating structured snippets.

  1. Open the plugin and select Add Snippet.
  2. Choose Add Your Custom Code.
  3. Select HTML Snippet as the snippet type.

Add snippet via customer codes in Code Snippets 4. Paste your Mark SDK snippet into the code editor.
5. Set the insertion location to Site Wide Header.
Select site wide header in Code Snippets 6. Save the snippet.
7. Return to the snippet list and toggle the snippet On to activate it.

Toggle the snippet on

Once enabled, the SDK will begin loading on all pages.

For most WordPress websites, using a header script plugin is the safest option.

It avoids theme update conflicts and keeps tracking logic easier to manage later.

You can visit the advanced tracking guide for wordpress users for more tracking setups.