One thing I’ve often thought about—especially when working with Outbound Marketing—is how to integrate a marketing form in the easiest and most efficient way. For Outbound, I really liked using form captures. But when it comes to Real-Time Marketing, let’s be honest… I prefer creating my marketing form in Dynamics 365 and embedding them with the Javascript option on the website.
Most of my forms use a consistent set of fields, so duplicating them across websites is just extra work. My goal? One reusable form, embedded on multiple websites, that still lets me identify where each submission came from—so I can route leads into the right journey.
And yes, that’s totally possible—with one simple script. Let’s dive in!
Step 1: Create a marketing form
First things first:
Go to Feature switches and enable Custom unmapped fields. This allows you to add new custom fields to the form—which we’ll need later to pass dynamic campaign values.
Create a new simple form and add a custom field of type Short Text. Name it something like Campaign, and hide the field from the user (I will not hide it yet for this demo purpose). Use a logical name like campaignValue. We’ll fill this hidden field dynamically via a Javascript we will add in the next step and it will be populated automatically. This same field will also be used for branching in your journey.
You can also add more hidden fields and fill them dynamically in the same way, depending on your use case.
Step 2: Add Javascript to the Marketing Form
Now let’s add a Javascript snippet to your marketing form. This script reads the campaign value from the website and injects it into the hidden field we just created.
Check my article if you need to know how to add Javascript to a marketing form: Read more.
Step 3: Embed the Form on Your Website
Once your form is ready, publish it and go to the publish options. From there, simply copy the embed Javascript code. You’ll use this same script on any page where you want the form to appear.
Your embed code should look something like this:
Now here comes the magic:
Just add a <div> above your form script with a data-campaign attribute. This is where you define the campaign value for that specific page:
Tip: You can extend this by adding more data-* attributes (e.g., data-website=”xyz”) and handle them with additional JavaScript in the marketing form if needed.
On my WordPress site, it looks exactly like this—and works seamlessly:
Step 4: Create a Journey with Attribute Branches
Now that your form submits a hidden campaign value, let’s create a journey that responds differently based on that field.
- Start with the Marketing Form Submitted trigger.
- Add an attribute branch.
- Set conditions based on the submitted Field Localized Name. You can find this name in the field submission table of the form submission record.
Use the Form Submission Field Snapshot to define the condition. Use the contains operator, and add the field name and value (e.g., campaignValue: SpringCampaign).
That way, the same form can drive different email journeys—depending on the website where it was embedded.
Summary
And that’s it!
Now you’ve got one marketing form you can embed across multiple websites—while still tracking where each contact comes from. This lets you personalize the journey and keep your form management clean and scalable.
You can use this method with any hidden field and value. The possibilities are endless—so get creative!
Final Thought
You might be wondering: why not just use UTM parameters?
While UTM parameters are great for tracking customer acquisition sources, this method focuses on form organization and experience personalization. Instead of managing multiple forms for each use case, you maintain just one—and inject dynamic behavior with Javascript.