Skip to main content

What this lets you do

Track AI-referred traffic on every page of your WordPress site without modifying plugin code or a child theme.

Before you start

  • Your Traceten site key, from Sites → Install in the dashboard.
  • WordPress admin access.
  • If you plan to use the theme editor: write access to your active theme’s files.
This method works regardless of your theme and survives theme updates.
1

Install the plugin

In your WordPress admin, go to Plugins → Add New and search for Insert Headers and Footers (by WPBeginner). Install and activate it.
2

Open the plugin settings

Go to Settings → Insert Headers and Footers.
3

Paste the snippet into the Header section

In the Scripts in Header box, paste your snippet tag:
Copy the whole tag from Sites → Install for your site so data-site (your site key) is already yours. data-cookie-domain is your own domain, which keeps one visitor as one visitor across your subdomains. It’s off by default, so it only appears on the tag once you’ve confirmed a value under Sites → Settings → Cookies.
4

Save

Click Save. The snippet is now live on every page of your site.

Method 2: Theme editor

Use this only if you are comfortable editing theme files directly. Child themes are recommended so your changes survive theme updates.
1

Open the theme editor

Go to Appearance → Theme Editor.If you see a warning that direct theme editing is disabled, you’ll need to use Method 1 or edit the file via FTP/SFTP.
2

Open header.php

In the file list on the right, click header.php (under Theme Files).
3

Find the closing </head> tag

Use Ctrl+F (or Cmd+F on Mac) to find </head>. Look for the line that reads </head> or contains wp_head() followed by </head>.
4

Paste the snippet just before </head>

Copy the whole tag from Sites → Install for your site so data-site (your site key) is already yours. data-cookie-domain is your own domain, which keeps one visitor as one visitor across your subdomains. It’s off by default, so it only appears on the tag once you’ve confirmed a value under Sites → Settings → Cookies.
5

Click Update File

Scroll to the bottom and click Update File. The snippet is now live on all pages.

Verify installation

Open your site in a browser, then open Sites → Install in the dashboard and look at the Verify step. It should turn green within 30 seconds of a pageview.

Notes

Caching plugins. If you use WP Rocket, W3 Total Cache, or another caching plugin, clear the cache after installing the snippet. Otherwise cached pages won’t include it. Page builders. Elementor, Divi, and Beaver Builder each have their own “custom code” sections. Using the Insert Headers and Footers plugin is simpler than hunting through builder settings. Child themes. If you edit header.php directly in a parent theme, a theme update will overwrite your change. Always use a child theme or use Method 1.

Next steps