Setup & Integration

Configure Tracking Events On WordPress

Understand where to place tracking code in WordPress and how to start with a simple and reliable setup.

If your website is built with WordPress, the easiest way to configure tracking events is by using a script plugin such as Code Snippets.

This section shows practical step-by-step examples that do not require editing theme files.

These examples help you track real marketing behaviour such as:

  • whether visitors reach a confirmation page
  • how often important buttons are clicked
  • whether key funnel steps are completed

Example 1. Track Visits To A Confirmation Page

Use Case

You want to measure when visitors successfully complete an action.

Typical situations include:

  • after submitting a contact or signup form
  • after joining a newsletter
  • after booking a demo
  • after completing onboarding
  • after finishing a purchase flow

These pages are often called thank-you pages or confirmation pages.

Tracking visits to these pages allows OneLence to understand real conversion outcomes.

Why This Is Important

This tracking method is:

  • simple
  • reliable
  • beginner-friendly
  • accurate for campaign performance measurement

It ensures conversions are counted only after the action is truly completed.

Step-By-Step Setup

  1. Open Code Snippets inside your WordPress dashboard.
  2. Click Add New.
  3. Select Add Your Custom Code.
    Add a new custom snippet
  4. Choose HTML Snippet.
    Select add HTML snippet
  5. In the Code Preview block, paste:
HTML
<script>
Mark.track("confirmation page viewed", {
  page_type: "signup_confirmation"
});
</script>

πŸ“Œ What This Code Mean

Event name β€” "confirmation page viewed"

This is the label of the action you want to record. It tells OneLence that a visitor reached a success page.

Event detail β€” page_type: "signup_confirmation"

This adds extra context about what kind of success happened. It helps you later compare different results like signup, purchase, or demo booking.

Added html snippet

  1. Scroll to Insertion β†’ Location. Set up Location
  2. Select Page-Specific β†’ Insert After Post. Select Page specific location
  3. Scroll to Smart Conditional Logic.
  4. Enable logic.
  5. Ensure the condition type is Show. Toggle on condition
  6. Click Add New Group.
  7. Configure the rule:
  • Target β†’ Where (Page) β†’ Page URLSelect page URL as target
  • Condition β†’ Is
  • Value β†’ paste the exact page URL (e.g. https://yourdomain.com/signup-confirmation)

Finished setup

  1. Click Save Snippet.
  2. Return to the snippet list.
  3. Toggle the snippet On. Toggle on the snippet

Now, whenever a visitor reaches this page, OneLence records the event.

Example 2. Track Clicks On A Specific Button

Use Case

You want to understand how often visitors interact with a key action.

Important buttons to track include:

  • login button
  • sign-up button
  • newsletter submit
  • add-to-cart button
  • pricing CTA
  • product detail clicks
  • β€œbook demo” button

This helps identify interest before conversion happens.

Why This Is Important

Button tracking helps you:

  • measure funnel drop-off
  • compare marketing channel engagement
  • understand feature interest
  • evaluate landing page performance

Step-By-Step Setup

Step 1. Add An Anchor ID To The Button

Edit the page containing the button.

Add an ID attribute to the button element. For example:

Toggle on the snippet

You can also achieve this step through the html code:

TS
<button id="btn_signup">Sign up</button>

The ID must be unique.

You can choose any clear name such as:

  • btn_signup
  • btn_demo
  • btn_checkout

Step 2. Create The Tracking Snippet

  1. Open Code Snippets.
  2. Click Add New.
  3. Select Add Your Custom Code. Add a new custom snippet
  4. Choose JavaScript Snippet. Select add JavaScript snippet
  5. Paste the following code:
HTML
const button = document.querySelector("#btn_signup");

if (button) {
  button.addEventListener("click", function () {
    Mark.track("signup button clicked", {
      button_id: "btn_signup"
    });
  });
}

πŸ“Œ What This Code Mean

#btn_signup β†’ the button ID you created

"signup button clicked" β†’ the event name shown in OneLence

button_id β†’ optional detail for later analysis

Code snippet for the button tracking

Step 3. Configure Snippet Placement

  1. Scroll to Insertion β†’ Location.
  2. Select Global β†’ Site Wide Footer.

Code snippet for the button tracking

This ensures the tracking script loads on every page.

  1. Click Save Snippet.
  2. Return to the snippet list.
  3. Toggle the snippet On. Toggle on the snippet

Now every time a visitor clicks the button, OneLence records the interaction.

If you are new to tracking configuration, start with only:

  • one confirmation page tracking snippet
  • one important button click tracking snippet

This already provides valuable insight into campaign effectiveness and user behaviour.

You can expand tracking later as you become more confident.

What You Should See After Setup

After publishing changes and receiving traffic:

  • confirmation page visits appear as events in OneLence
  • button clicks begin appearing in engagement insights
  • attribution reports connect marketing sources to these actions