WP UTM Sticky
WordPress plugin for persistent UTM attribution across links, forms, email templates, and WooCommerce orders.
Install
No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:
wp plugin install https://github.com/irina-grigoreva/wp-utm-sticky/archive/refs/heads/main.zipReadme
WP UTM Sticky
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
- Copy the
wp-utm-stickydirectory towp-content/plugins/. - Activate the plugin in WordPress admin.
- Open
Settings -> WP UTM Sticky. - 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_bootutm_sticky_keysutm_sticky_append_keysutm_sticky_click_modeutm_sticky_cookie_ttl_daysutm_sticky_form_integrationsutm_sticky_exclude_pathswp_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 theSecureflag. - 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.phpincludes/inc/assets/languages/README.md
Files listed in .distignore are development files and should stay out of release archives.