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:
- Injects the Clickport tracker script into the
<head>of every page - Auto-detects your site's domain on activation
- Lets you exclude logged-in administrators from tracking
- Cleans up all settings when uninstalled
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.
Installation
- Download the Clickport WordPress plugin (.zip, ~3 KB)
- In your WordPress admin, go to Plugins > Add New > Upload Plugin and upload the zip file
- Click Install Now, then Activate Plugin
- 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.
Plugin settings
The settings page is located at Settings > Clickport Analytics in your WordPress admin. There are two fields:
| Domain |
The domain registered in your Clickport dashboard.
|
|---|---|
| Exclude admins |
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 complements the "Exclude my visits" feature in the Clickport dashboard. The dashboard toggle hides a single device via a localStorage flag, while this plugin option hides every admin regardless of device. Use both together if you want both: admins automatically skipped by the plugin, and specific devices (your phone, a tablet) excluded on top via the dashboard toggle. See Exclude Your Visits for the dashboard flow.
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:
The injection only happens when two conditions are met:
- The Domain field is not empty
- If "Exclude admins" is enabled, the current user does not have the
manage_optionscapability
The script is loaded with the defer attribute, so it never blocks page rendering. Visitors will not notice any difference in load time.
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:
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:
tracker.jsloaded fromhttps://clickport.io/tracker.jswith a 200 status- A POST request to
https://clickport.io/api/event(the first pageview)
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.
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.
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:
- Add the tracker manually with the additional attributes (see Script Configuration)
- Use a "Custom Code" plugin to add a
cpConfigscript block before the tracker loads
For most WordPress sites, the default plugin configuration with just the domain is all you need.
Troubleshooting
Tracker not appearing in page source
- Make sure the Domain field is not empty in Settings > Clickport Analytics. The plugin will not inject anything if the domain is blank.
- Check that you are viewing the page while logged out. If "Exclude admins" is enabled, the script is not injected for admin users.
- Verify the plugin is activated in the Plugins list.
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.
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
- Verify the tracker is in the page source (see above)
- Check the Network tab for a successful POST to
/api/event - Make sure your Clickport trial has not expired
- Confirm you are looking at the correct site in the dashboard if you have multiple sites