CMS & Web Platforms · One line of code

WordPress integration

Add the SourceTrack tracker to WordPress with a header snippet plugin, or ask for the SourceTrack WordPress plugin. Form plugins are recognised.

No credit card required · one script tag

Add the SourceTrack tracker to your WordPress site with one script tag in the page head. It records which channel and campaign brought each visitor, and it recognises several WordPress form plugins.

What SourceTrack records

  • Pageviews and sessions: each page a visitor views, with the referrer and landing page.
  • Campaign data: UTM parameters and ad click ids in the landing URL, such as gclid and fbclid.
  • Form submits from forms in the page, labelled wordpress for common form plugins (see WordPress form plugins). The event holds the form’s id, name and action path, not what the visitor typed.
  • Time on page and scroll depth, outbound link clicks and tel: link clicks.

What SourceTrack does not do

  • The tracking snippet does not detect purchases. Orders and revenue come from the SourceTrack WordPress plugin (WooCommerce), a Shopify or Stripe connection, or a sourcetrack.conversion() call.
  • The snippet runs in the visitor’s browser and does not write to your WordPress database.
  • It sends nothing for visitors who send Do Not Track or Global Privacy Control.

Step-by-step setup

  1. In WordPress admin go to Plugins → Add New and install WPCode (or another “insert headers and footers” plugin).
  2. Open the plugin’s header settings and paste:
    <script async src="https://api.srctk.com/tracker.min.js" data-site-key="YOUR_SITE_KEY"></script>
    Replace YOUR_SITE_KEY with your site key from SourceTrack.
  3. Save.
  4. Clear your page cache if you use a caching plugin.

Option B: edit the theme

Paste the same snippet before the closing </head> tag in your theme’s header.php. A theme update overwrites this unless you use a child theme.

Option C: Google Tag Manager

If your site already loads GTM, use the Google Tag Manager guide.

Option D: the SourceTrack WordPress plugin

There is a SourceTrack WordPress plugin that adds the tracker tag and records form leads and WooCommerce orders from your server. It is not listed in the WordPress.org directory and has no public download. It is available on request through contact. Details are in the WordPress setup guide.

Check that it works

  1. Open your site in a private window.
  2. Open developer tools, go to Network and filter by track.
  3. Reload and confirm a request to /api/track completes.
  4. Look for the visit in the Event Debugger in your SourceTrack dashboard.

Common problems and fixes

  • Nothing is recorded after saving. A caching plugin may still serve the old HTML. Clear the cache and check the page source for tracker.min.js.
  • A minify or combine setting breaks the script. Exclude tracker.min.js from minification and combining.
  • Visits from your own browser are missing. Do Not Track and Global Privacy Control suppress tracking. Test in a window without them.

See also Troubleshooting.


Frequently Asked Questions

Does SourceTrack write to my WordPress database?

The tracking snippet does not. It sends events from the visitor’s browser to SourceTrack.

Does this work with caching plugins and CDNs?

The snippet is a normal script tag, so it is served with your cached pages. After you add it, clear the cache so cached pages include it. If a plugin minifies or defers scripts, exclude tracker.min.js if you see errors.

Does it track WooCommerce purchases?

Not from the snippet. See the WooCommerce integration or the WordPress plugin for orders and revenue.