WP Manifestindependent plugin directory
manifest / analytics / wp-utm-sticky

WP UTM Sticky

WordPress plugin for persistent UTM attribution across links, forms, email templates, and WooCommerce orders.

★ 0stars

Install

Download source zip No release zip yet

This is the repository archive. It installs, but the folder name will carry the branch suffix and updates will not flow.

Install straight from GitHub with WP-CLI:

wp plugin install https://github.com/irina-grigoreva/wp-utm-sticky/archive/refs/heads/main.zip
No built-in updater. New versions won't appear under Dashboard → Updates. Install new releases yourself, or let Git Updater track the repository.

WordPress plugin for keeping UTM and ad click parameters available after the first landing page.

The plugin stores selected parameters in cookies/session storage, appends them to internal links, passes them to supported forms, and can save them to WooCommerce order meta.

Features

  • Base UTM parameters: utm_source, utm_medium, utm_campaign, utm_term, utm_content.
  • Ad click IDs: gclid, fbclid, yclid, msclkid.
  • Custom parameter names with validation and a 10-item limit.
  • First-click and last-click attribution modes.
  • Cookie TTL from 30 to 90 days.
  • Hidden fields for Contact Form 7, Elementor Forms, WPForms, Ninja Forms, and Gravity Forms.
  • WooCommerce order meta fields with optional reset after conversion.
  • Same-site email link rewriting.
  • Canonical URL cleanup for tracked parameters.
  • Optional server-side cookie mode for cached sites.

Installation

  1. Copy the wp-utm-sticky directory to wp-content/plugins/.
  2. Activate the plugin in WordPress admin.
  3. Open Settings -> WP UTM Sticky.
  4. Select the parameters and integrations used on the site.

Settings

The settings page controls:

  • Parameters to store.
  • Custom parameters.
  • Attribution mode.
  • Form integrations.
  • Retention period.
  • Cache compatibility mode.
  • Email and thank-you page helpers.
  • WooCommerce order meta integration.

If no base or custom parameters are selected, frontend tracking is disabled.

Stored order meta

When WooCommerce integration is enabled, checkout saves values using the _utm_sticky_ prefix:

_utm_sticky_utm_source
_utm_sticky_utm_medium
_utm_sticky_utm_campaign

The exact list depends on the selected parameters.

Hooks

add_filter( 'utm_sticky_exclude_paths', function ( array $paths ) {
    $paths[] = '/account';
    return $paths;
} );

add_filter( 'wp_utm_sticky_thankyou_share_url', function ( $url, WC_Order $order ) {
    return home_url( '/refer-a-friend/' );
}, 10, 2 );

Available filters:

  • utm_sticky_should_boot
  • utm_sticky_keys
  • utm_sticky_append_keys
  • utm_sticky_click_mode
  • utm_sticky_cookie_ttl_days
  • utm_sticky_form_integrations
  • utm_sticky_exclude_paths
  • wp_utm_sticky_thankyou_share_url

Development

composer install
composer test
composer phpcs
composer phpstan

composer test runs PHP syntax checks and a small smoke test. The GitHub Actions workflow also runs PHPCS and PHPStan.

Privacy notes

  • Values are sanitized and limited to 200 characters.
  • Custom parameter names that look like personal data are rejected.
  • Cookies use SameSite=Lax; HTTPS sites also get the Secure flag.
  • Email links are changed only for same-site or relative URLs.
  • mailto:, tel:, sms:, and hash-only links are ignored.

Release package

Runtime files:

  • wp-utm-sticky.php
  • includes/
  • inc/
  • assets/
  • languages/
  • README.md

Files listed in .distignore are development files and should stay out of release archives.