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
gclidandfbclid. - Form submits from forms in the page, labelled
wordpressfor 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
Option A: a header snippet plugin (recommended)
- In WordPress admin go to Plugins → Add New and install WPCode (or another “insert headers and footers” plugin).
- Open the plugin’s header settings and paste:
Replace<script async src="https://api.srctk.com/tracker.min.js" data-site-key="YOUR_SITE_KEY"></script>YOUR_SITE_KEYwith your site key from SourceTrack. - Save.
- 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
- Open your site in a private window.
- Open developer tools, go to Network and filter by
track. - Reload and confirm a request to
/api/trackcompletes. - 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.jsfrom 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.