Hey there, Trailblazers.
If you caught my last post, you’ll remember we built a multilingual Pardot form without using any fancy dropdown select—everything switches based on URL language. Today, I want to show how I refined it. We’ve added UTM-based thank-you messages, dynamic form action logic, and automated campaign assignment.
What’s New with Progressive Tracking
Here’s what I added since the first post:
- Thank-you messages that change based on UTM + language combo
- Auto-updating form action, so submissions always post back to the full URL (with UTM intact)
- Storing the full URL in a hidden field, so Pardot automation can match form submissions to campaigns directly
Step-by-Step Breakdown
1. Thank You Logic Based on UTM + Language
Instead of just looking for spring_launch in the URL, now the thank-you content is smart:
const url = window.location.href.toLowerCase();
const lang = url.includes('/es') ? 'es'
: url.includes('/fr') ? 'fr'
: 'en';
const isSpring = url.includes('utm=spring_launch');
const isFall = url.includes('utm=fall_sale');
// Show proper content block based on both UTM and language
if (isSpring) {
document.getElementById(`springContent-${lang}`).style.display = 'block';
} else if (isFall) {
document.getElementById(`fallContent-${lang}`).style.display = 'block';
} else {
document.getElementById('defaultContent').style.display = 'block';
}
Now, whether someone lands on /es?utm=spring_launch or /fr?utm=fall_sale, they’ll see a localized, campaign-matching message. No duplicates of dropdowns. No extra pages. Clean.
2. Make the Form Action Reflect the Current URL
This one’s a small detail—but it’s a lifesaver when UTMs disappear.
document.addEventListener('DOMContentLoaded', () => {
const form = document.querySelector('form');
if (!form) return;
form.action = window.location.href;
});
Whether the form is in a modal, embedded, or its own page—on submit, the UTM stays with it.
3. Let Pardot Know What Campaign This Submission Belongs To
I added a hidden field (hiddenPageUrl) and populate it with:
document.querySelector('.hiddenPageUrl input').value = window.location.href;
Then, in Pardot Automation Rules, it’s easy to say:
- If
hiddenPageUrlcontainsspring_launch, assign to Spring Launch Campaign - If it contains
fall_sale, assign Fall Sale Campaign
Simple logic, zero confusion, even if someone moves around your site before submitting.
How to Scale or Tweak This
| Change Needed | What to Do |
|---|---|
| Add a new language (e.g. German) | 1. Add translations in the layout template 2. Detect /de 3. Add springContent-de, fallContent-de blocks |
| Add a new campaign (e.g. Winter promo) | 1. Add winterContent-xx blocks 2. Detection: url.includes("utm=winter_promo") |
| Change the hidden field selector | Update the .hiddenPageUrl input selector to match your HTML |