Clickport
Start free trial

WordPress

The official Clickport WordPress connector plugin adds the tracking script to every page on your site automatically. Install it, enter your domain, and you are done. No code editing required.

Overview

The Clickport Analytics plugin for WordPress handles everything you would otherwise do manually:

The plugin requires WordPress 5.0 or later and PHP 7.4 or later. It is lightweight with no external dependencies, and the tracker itself is under 5 KB gzipped.

Clickport account required. You need an active Clickport account with your site already added. Sign up free if you have not yet, then come back here to install the plugin.

Installation

  1. Download the Clickport WordPress plugin (.zip, ~3 KB)
  2. In your WordPress admin, go to Plugins > Add New > Upload Plugin and upload the zip file
  3. Click Install Now, then Activate Plugin
  4. Go to Settings > Clickport Analytics to verify your domain and configure options

On activation, the plugin automatically detects your WordPress site's domain (stripping www.) and fills it in for you. The "Exclude admins" option is also enabled by default.

You can also install manually: unzip the file and upload the clickport folder to /wp-content/plugins/ via FTP or your file manager.

Quick access: After activation, you will see a "Settings" link directly on the Plugins page next to the Deactivate link. Click it to jump straight to the configuration.

Plugin settings

The settings page is located at Settings > Clickport Analytics in your WordPress admin. There are two fields:

Settings > Clickport Analytics
Clickport Analytics
Domain
The domain registered in your Clickport dashboard.
Exclude admins
Save Changes

Domain

The domain that matches your site in the Clickport dashboard. This value is passed as the data-domain attribute on the tracker script. It should match exactly what you registered when adding the site to Clickport (without https:// or www.).

On plugin activation, this field is automatically populated from your WordPress site URL. If your WordPress address is https://www.yoursite.com, the plugin strips the www. prefix and sets the domain to yoursite.com.

Exclude admins

When enabled (the default), the plugin skips injecting the tracker script for any logged-in user with the manage_options capability. This means administrators browsing the site will not generate any tracking data.

This is the WordPress equivalent of the "Exclude my IP" feature in the Clickport dashboard, but it works based on your login status rather than IP address. It is especially useful when your IP changes frequently or when multiple admins need to be excluded.

How it works

The plugin hooks into WordPress's wp_head action to inject a single script tag into the <head> of every page. Here is exactly what it outputs:

Injected HTML output
This is added to every page's <head> section
<script defer data-domain="yoursite.com" src="https://clickport.io/tracker.js"></script>
The domain value comes from your plugin settings.

The injection only happens when two conditions are met:

  1. The Domain field is not empty
  2. If "Exclude admins" is enabled, the current user does not have the manage_options capability

The script is loaded with the defer attribute, so it never blocks page rendering. Visitors will not notice any difference in load time.

Clean uninstall. When you uninstall the plugin (not just deactivate), it removes all stored options from the WordPress database. No leftover data.

Verifying the installation

After activating the plugin and saving your domain, verify that the tracker is loading correctly.

Check the page source

Visit your site while logged out (or in an incognito window), right-click the page, and select "View Page Source." Search for clickport. You should see the script tag in the <head> section:

View Page Source
Search for "clickport" in your page source
<head> <meta charset="UTF-8"> <script defer data-domain="yoursite.com" src="https://clickport.io/tracker.js"></script> <meta name="viewport" ...> <title>My WordPress Site</title> ... </head>

Check the Network tab

Open your browser's developer tools (F12), switch to the Network tab, and reload the page. Filter by "tracker" or "clickport." You should see two requests:

Browser Network tab
Filter by "clickport" to find the tracker requests
Name Status Type Size
tracker.js 200 script 4.8 KB
event 200 fetch 112 B

Check the Clickport dashboard

Open your Clickport dashboard and look at the Realtime view. Your visit should appear within 30 seconds. If you have the "Exclude admins" option enabled, make sure you are testing while logged out of WordPress.

Not seeing data? If you are logged in as a WordPress administrator with "Exclude admins" enabled, the tracker will not load. Log out or use an incognito window to test.

Manual installation alternative

If you prefer not to use a plugin, you can add the tracking script manually to your WordPress theme. Open your theme's header.php file (Appearance > Theme File Editor) and paste the snippet inside the <head> tag:

<head>
  <!-- Clickport Analytics -->
  <script defer data-domain="yoursite.com"
    src="https://clickport.io/tracker.js"></script>

  <?php wp_head(); ?>
</head>

Alternatively, use a plugin like "Insert Headers and Footers" (WPCode) to inject the snippet without editing theme files.

Theme updates. If you edit header.php directly, your changes will be lost when the theme updates. Use a child theme or the Clickport plugin to avoid this.

Advanced configuration

The WordPress plugin injects a standard tracker script tag with the data-domain attribute. If you need advanced options like API key authentication (data-site), custom API endpoints (cpConfig.api), or 404 detection overrides, you will need to either:

For most WordPress sites, the default plugin configuration with just the domain is all you need.

Troubleshooting

Tracker not appearing in page source

Caching plugins

If you use a caching plugin (WP Super Cache, W3 Total Cache, LiteSpeed Cache, WP Rocket, etc.), clear your cache after activating the Clickport plugin. Cached pages will not include the tracker until the cache is refreshed.

Also check that your caching plugin is not minifying or combining JavaScript in a way that breaks the tracker. The Clickport script relies on reading its own data-domain attribute, which may not work if the script tag is rewritten during minification.

Tip: Most caching plugins let you exclude specific scripts from minification and concatenation. Add clickport.io/tracker.js to the exclusion list if you run into issues.

Security plugins blocking the script

Content Security Policy (CSP) headers or security plugins may block external scripts. If the tracker is not loading, check your browser console for CSP errors. You may need to add https://clickport.io to your site's script-src directive.

Domain mismatch

The domain in the plugin settings must match the domain registered in your Clickport dashboard. If your WordPress site is at www.yoursite.com but you registered yoursite.com in Clickport, that is fine. The plugin strips the www. prefix automatically. But if the domains are completely different, the tracker will not be able to associate events with your site.

No data in the dashboard