Skip to main content

Installing the Tracking Code via WordPress Plugin

Updated over 8 months ago

If you use WordPress, adding the Click Guardian tracking code to your website is simple—even if you don’t have access to or experience with editing theme files. Using a plugin like WPCode (previously known as Insert Headers and Footers) allows you to place the required code into your site's <head> and <body> without touching your codebase.

This method ensures the Click Guardian script loads correctly on every page, helping to identify suspicious traffic and apply your exclusion rules consistently.


Why Use WPCode?

Some WordPress themes or visual page builders don’t include built-in tools to inject code site-wide—especially in both the <head> and <body> sections. WPCode is a free, lightweight plugin that solves this by giving you direct access to these areas in a safe, user-friendly interface.


Steps to Install Click Guardian Using WPCode

  1. Install the WPCode Plugin

    • In your WordPress dashboard, go to Plugins > Add New

    • Search for “WPCode” (by WPCode – Insert Headers and Footers + Custom Code Snippets)

    • Click Install Now, then Activate

  2. Access the Code Snippets Settings

    • After activation, a new menu called “Code Snippets” will appear in your WordPress sidebar

    • Click Header & Footer under this menu

  3. Add the Tracking Code

    • In the Header section, paste the Click Guardian <script> code snippet (this part tracks users with JavaScript enabled)

    • In the Body section, paste the <noscript> code (needed if you're using the “Block Visitors with JavaScript Disabled” rule)

    ⚠️ Important: Do not edit or minify the code. Changes may prevent it from functioning properly.

  4. Save Your Changes

    • Once both code blocks are in place, scroll down and click Save Changes

    • The tracking code is now active across all pages of your site


Alternatives for WordPress Users

If WPCode doesn’t suit your needs or conflicts with other plugins, you can:

  • Use a theme or builder with native support for adding custom code (e.g., Astra, GeneratePress, or Elementor Pro)

  • Add the tracking code manually via your theme’s header.php and footer.php files (recommended only if you’re comfortable editing PHP)

Did this answer your question?