← All docs

Installation

Install SourceTag on WordPress

The WordPress plugin loads the tracking script on your site and can set server-side cookies so Safari doesn’t strip your attribution data after 7 days.

Step 1: Install the plugin

  1. Download the latest release (.zip) from GitHub
  2. In WordPress, go to Plugins → Add New → Upload Plugin
  3. Upload the .zip file and activate

The plugin checks for updates automatically via GitHub, so you’ll be notified in WordPress when a new version is available.

Step 2: Enter your Script URL

  1. Go to Settings → SourceTag
  2. Paste your Script URL (found on your site’s detail page in the SourceTag dashboard). It looks like https://cdn.sourcetag.io/scripts/YOUR_SITE_ID/st.js
  3. Click Save Changes

The plugin now loads the tracking script on every page of your site.

Step 3: Enable server-side cookies (optional)

Safari, Brave, and other privacy-focused browsers limit JavaScript cookies to 7 days. If your sales cycle is longer than a week, enable server-side cookies:

  1. In Settings → SourceTag, tick Enable server-side cookie setting
  2. Save Changes

This makes the plugin re-set the attribution cookie via PHP setcookie() on every page load. Safari treats HTTP-header-set cookies as server cookies, allowing up to 400 days of persistence.

Step 4: Test

  1. Visit your site with UTM parameters: ?utm_source=test&utm_medium=cpc
  2. Submit any form on your site
  3. Check the form notification email. You should see hidden fields like st_fc_channel, st_lc_source, etc.

Compatible form builders

The plugin works with any WordPress form builder:

  • Contact Form 7
  • Gravity Forms
  • WPForms
  • Elementor Forms
  • Formidable Forms
  • Ninja Forms
  • Any form that renders standard HTML <form> elements

You’ll need to add hidden fields to your forms for the attribution data you want to capture. SourceTag detects forms on the page and populates any matching hidden fields on submission. See Add Hidden Fields for the field names.

Troubleshooting

Hidden fields not appearing: Make sure your forms have hidden fields with the correct field names (see Add Hidden Fields). Also check the Script URL is correct and your site has been added in the SourceTag dashboard. View the page source to confirm the script tag is present.

Server-side cookies not working: The cookie refresh happens on PHP’s init hook, before any output. If you’re using full-page caching (WP Rocket, W3 Total Cache), the PHP hook may not run on cached pages. Exclude pages with forms from the cache, or configure the cache to pass cookies through.

Doesn't answer your question or need more help? Get in touch.