You can use our AFL UTM Tracker plugin to capture dynamic UTM parameters for your Formstack submissions embedded into your WordPress page.
We will using our Javascript Merge Tags feature to populate the UTM parameters and other attribution data into the Formstack hidden fields.
Minimum Requirements
- AFL UTM Tracker v2.23.0
- Formstack Javascript Embed Code
- WordPress v5.0.0
Changelog
- 2025-08-06
- Updated Appfromlab HTML Code to support optout value.
Steps
Let’s summarize the steps to populate the UTM parameters into your Formstack.
- Enable the “Javascript Merge Tag” feature under the AFL UTM Tracker plugin settings.
- Create Hidden Fields on Formstack.com.
- Get your Formstack Embed Code.
- Get our Appfromlab HTML Code.
- Paste our Appfromlab HTML Code into your WordPress page.
- Test your Formstack.
- View your Formstack submission.
1. Enable the Javascript Merge Tag feature
- Login to your WordPress Admin dashboard.
- Go to AFL UTM Tracker > Settings page.
- Under Attribution section, enable the Javascript Merge Tag feature.
- Save settings.
- Clear all page cache from your caching plugin.
2. Create Hidden Fields on Formstack.com
- Login to your Formstack account.
- Go to your form.
- Go to the “Build” tab.
- Let’s say you want to capture the “Last Touch UTM Source”:
- Drag and drop a “Short Answer” field to the form.
- Field Label: Last UTM Source
- Hidden: Checked
- Default Value: afl_utm_js:utm_source
- Capture the “Last Touch UTM Medium”:
- Drag and drop a “Short Answer” field to the form.
- Field Label: Last UTM Medium
- Hidden: Checked
- Default Value: afl_utm_js:utm_medium
- Capture the “Last Touch UTM Campaign”:
- Drag and drop a “Short Answer” field to the form.
- Field Label: Last UTM Campaign
- Hidden: Checked
- Default Value: afl_utm_js:utm_campaign

Want to populate more attribution data?
Refer to our Javascript Merge Tag list to populate First Touch UTM parameters, Last Touch UTM parameters, click identifiers and other attribution data.
Certain attribution data like URLs may require you to use the “Long Answer” field.
3. Get your Formstack Javascript Embed Code
- Go to the Formstack account > Form > Share tab.
- Look for the Website Embed section > Javascript Embed Code.
- Copy the Javascript Embed Code by clicking on the “Copy code” button.

4. Get our Appfromlab HTML Code
- On Line 3, replace MY_DOMAIN_NAME with your website URL.
5. Paste our Appfromlab HTML Code into your WordPress page
- Login to your WordPress page.
- Edit your Contact Form page.
- Add the “Custom HTML” block.
- Paste your Formstack Javascript Embed Code into the block.
- Add another “Custom HTML” block below.
- Paste our Appfromlab Javascript Code below into the block.
- Save page and clear page cache.

6. Test your Formstack
- Generate your UTM tracking URL.
- Visit your UTM URL in private-browsing mode to simulate a new visitor.
- Submit the form.
7. Check your Formstack Submission
- Go to your Formstack account.
- Go to your Form > Submissions tab.
- View the submission.
