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.

You would only need to use the merge tags when:

  • No native 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 native 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 custom 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.

We will begin to write more tutorials for CRM-based forms in the coming weeks.

Requirements

  • AFL UTM Tracker v2.16.2 or above

How to use merge tags?

AFL UTM Tracker > Settings

  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

Form Builder

  1. Go to your form builder.
  2. Add a hidden field to the form.
  3. In the Default Value property, use one the merge tag below.
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_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
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

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

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