How can we help?

Installing Tracking Code on a WordPress Website

01/06/2025

How to Install ClickSambo on a WordPress Website

To fully protect your WordPress site, you must install both ClickSambo tracking codes into your site's template

The Tracking Code (HEAD Section) acts as the primary analysis engine, while the NoScript Tracking Code (BODY Section) serves as an essential fallback.

This guide covers four methods, from easiest to most advanced. For most users, the Plugin method is the safest and highly recommended.

Step 1: Get Your Tracking Codes

Before you begin, copy both of your unique ClickSambo tracking codes from your dashboard.

Log in to your ClickSambo account.

Navigate to Account > Account Settings > Domain Tracking Setup.

Select your domain and copy both the Tracking Code (HEAD Section) and the NoScript Tracking Code (BODY Section).

Step 2: Choose Your Installation Method

Select one of the methods below to add the codes to your WordPress site.

 

Method A: Use a Plugin (Recommended)

This is the easiest and safest way to add the codes without editing your theme files directly.

In your WordPress Admin dashboard, go to Plugins > Add New.

Search for WPCode – Insert Headers and Footers. Install and Activate the plugin.

In the left-hand menu, navigate to Code Snippets > Header & Footer.

You will see two boxes:Paste your Tracking Code (HEAD Section) into the "Header" box.

Paste your NoScript Tracking Code (BODY Section) into the "Body" box.

Click Save Changes. The plugin will now correctly inject both codes into every page of your site.

Method B: Use Your Theme's Built-in Options

Some themes provide built-in fields for adding scripts.

In your WordPress Admin, go to Appearance > Customize.

Look for sections named "Theme Settings," "Custom Code," or "Scripts."

Find two separate fields for adding code to the HTML <head> and <body>.

  • Paste the Tracking Code (HEAD Section) into the Header field.
  • Paste the NoScript Tracking Code (BODY Section) into the Body field

Publish your changes. If your theme only provides a Header field, please use Method A instead.

Method C: Use Google Tag Manager (GTM)

If you already have GTM installed on your site, do not use the methods above.

Instead, follow our dedicated guide for the specific hybrid installation required. 

Method D: Edit Theme Files (Advanced Users Only)

Warning: This method is for advanced users only. Editing theme files can break your site if done incorrectly.

Always use a Child Theme to prevent your changes from being erased when you update your main theme.

In WordPress Admin, go to Appearance > Theme File Editor.

From the dropdown on the right, make sure you select your Child Theme.

Find and click on the Theme Header (header.php) file to open it.

Carefully paste the Tracking Code (HEAD Section) just before the closing </head> tag.

Carefully paste the NoScript Tracking Code (BODY Section) just after the opening <body> tag.

Click Update File. Check your site immediately for any errors.

Step 3: Clear All Caches

After adding the codes via any method, it is critical to clear your website's cache. Go to your caching plugin's settings (e.g., LiteSpeed Cache, WP Rocket, W3 Total Cache) and purge all caches. If you use a CDN like Cloudflare, clear its cache as well.

Step 4: Verify the Installation

Open any page of your live website in a new incognito browser window.

Right-click the page and select "View Page Source".

Confirm the HEAD code: Search (Ctrl+F) for cdn.clicksambo.com. You should find your script inside the <head> section.

Confirm the BODY code: Search again for ping.clicksambo.com. You should find your <noscript> code immediately after the opening <body> tag.

Did this answer your question?
Customise Consent Preferences
Cookies

CookieConsentIntro

CookieConsentNecessary

CookieConsentThirdParty

CookieConsentChoice

Show More
Cookies Necessary
Always Active

Necessary cookies are required to enable the basic features of this site, such as providing secure log-in or adjusting your consent preferences. These cookies do not store any personally identifiable data.

Cookies Functional

Functional cookies help perform certain functionalities like sharing the content of the website on social media platforms, collecting feedback, and other third-party features.

Cookies Analytics

Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics such as the number of visitors, bounce rate, traffic source, etc.

Cookies Performance

Performance cookies are used to understand and analyse the key performance indexes of the website which helps in delivering a better user experience for the visitors.

Cookies Advertisement

Advertisement cookies are used to provide visitors with customised advertisements based on the pages you visited previously and to analyse the effectiveness of the ad campaigns.

Cookies Uncategorised

Other uncategorised cookies are those that are being analysed and have not been classified into a category as yet.