AFL UTM Tracker Documentation

  1. Home
  2. Docs
  3. AFL UTM Tracker Documentation
  4. Developer
  5. Javascript Merge Tags

Javascript Merge Tags

The AFL UTM Tracker plugin now supports for populating UTM parameters into the form hidden fields using the Javascript Merge Tags feature.

You would only need to use the merge tags when:

  • No seamless integrations: Allows you to populate UTM parameters on any WordPress form builder that we have yet to build native integration. Check out our list of seamless form integration.
  • CRM-based forms: Allows you to populate UTM parameters into an embedded form widget (e.g Hubspot, Zoho, Formstack, Mailchimp). May require additional Javascript code if the form is not in raw HTML.
  • Form’s Conditional Logic: Allows you to use the form’s conditional logic to show fields / sections based on certain UTM parameter.

Minimum Requirements

  • AFL UTM Tracker v2.16.2 or above

Enable the Javascript Merge Tag feature

  1. Login to your WordPress dashboard.
  2. Go to the AFL UTM Tracker plugin > Settings.
  3. Under the Attribution section > Enable the “Javascript Merge Tag” feature.
  4. Save settings and clear page cache.
Attribution > Javascript Merge Tag
Attribution > Javascript Merge Tag

Using Javascript Merge Tag in the Hidden Fields

  1. Go to your form builder.
  2. Add a hidden field to the form.
  3. In the Default Value property, use one of our merge tags in the list below.

Note: Some form builders have 256 character limitation for a hidden field / short text field. If you are storing a URL, you may need to use a Long text / Text Area field. But make sure to keep the Field Visibility to hidden.

Formidable Forms > Hidden Field
Formidable Forms > Hidden Field

List of Merge Tags

Attribution Data (afl_utm_js:attribution_name)

First Landing Page URL
afl_utm_js:sess_landing

First Website Referer URL
afl_utm_js:sess_referer

First Touch UTM URL
afl_utm_js:utm_url_1st

First Touch UTM parameters
afl_utm_js:utm_source_1st
afl_utm_js:utm_medium_1st
afl_utm_js:utm_campaign_1st
afl_utm_js:utm_term_1st
afl_utm_js:utm_content_1st
afl_utm_js:utm_id_1st
afl_utm_js:utm_source_platform_1st
afl_utm_js:utm_creative_format_1st
afl_utm_js:utm_marketing_tactic_1st

Last Touch UTM URL
afl_utm_js:utm_url

Last Touch UTM parameters
afl_utm_js:utm_source
afl_utm_js:utm_medium
afl_utm_js:utm_campaign
afl_utm_js:utm_term
afl_utm_js:utm_content
afl_utm_js:utm_id
afl_utm_js:utm_source_platform
afl_utm_js:utm_creative_format
afl_utm_js:utm_marketing_tactic

GCLID (Google Click Identifier)
afl_utm_js:gclid_url
afl_utm_js:gclid_value

FBCLID (Facebook Click Identifier)
afl_utm_js:fbclid_url
afl_utm_js:fbclid_value

MSCLKID (Microsoft Click Identifier)
afl_utm_js:msclkid_url
afl_utm_js:msclkid_value

Custom Click Identifier (replace clid with your click identifier)
afl_utm_js:clid_url
afl_utm_js:clid_value

Merge Tag Filters

A pipe “|” character is placed after the attribution name. Then a filter name is added to manipulate the value.

Extract Custom Parameter from URL (param:param_name)

Extract matchtype parameter from the First Touch UTM URL
afl_utm_js:utm_1st_url|param:matchtype

Extract matchtype parameter from the Last Touch UTM URL
afl_utm_js:utm_url|param:matchtype

Extract ref parameter from the First Landing Page URL
afl_utm_js:sess_landing|param:ref

Set a Default Value (default:enter_a_value)

Set the default value to none when matchtype is blank
afl_utm_js:utm_url|param:matchtype|default:none

Set the default value to none when Last Touch utm_campaign is blank
afl_utm_js:utm_campaign|default:none

URL filters (url:part_name)

URL without query parameters
afl_utm_js:utm_url|url:clean

Other supported part name according to Javascript spec
afl_utm_js:utm_url|url:hash
afl_utm_js:utm_url|url:host
afl_utm_js:utm_url|url:hostname
afl_utm_js:utm_url|url:href
afl_utm_js:utm_url|url:origin
afl_utm_js:utm_url|url:pathname
afl_utm_js:utm_url|url:protocol
afl_utm_js:utm_url|url:search

Reference: https://developer.mozilla.org/en-US/docs/Web/API/URL/URL

Using Multiple Merge Tags

You can use multiple merge tags in a single field by enclosing each merge tag with an open and close curly brackets.

This feature requires AFL UTM Tracker version 2.23.0.

Last UTM Source / Last UTM Medium (e.g google/cpc)
{afl_utm_js:utm_source}/{afl_utm_js:utm_medium}