Ad hoc merge fields give you extra flexibility when personalizing pages. That’s because they allow you to insert dynamic content on the fly. Regular merge fields pull data from your records, and ad hoc merge fields use the URL to insert content into your page. These fields make it easy to customize your pages without creating custom fields or masking the field name you want to prefill.
How do ad hoc merge fields work?
When you use ad hoc merge fields, you need to add the name of your merge field and its value in your URL. If the ad hoc merge field on your page matches the merge field in your URL, your page will automatically fill it in with the value from your URL.
The example below shows ad hoc merge fields on a page. However, you can also use them to prefill visible and hidden fields on forms.
This process can help collect information about new leads before they opt in. For example, say your homepage includes links to different topics. You can use ad hoc merge fields to save new leads’ interests based on what they clicked before opting in.
And the ad hoc merge fields allow you to mask the field you’re populating with a simpler term. For example, if you want to prefill a “Lead interest” field, you could replace the label with something simple like “int” for a cleaner-looking URL.
Create custom links with ad hoc merge fields
Pass the information you want to send by attaching a few parameters to the end of your custom link. Before you begin this process, be sure that the page you are creating a link for is already published.
Here’s an example of a link to a cardio fitness page that populated the ad hoc merge field [int] with the value “cardio”:
Creating these links is more manageable than it might seem. You will need your URL, an ad hoc field name and a value first.
Ad hoc field names: Any text you want
- The only stipulations are that the merge field in your URL must be URL encoded — spaces need to be replaced with “+” or “%20” — and it must match the merge field you add to your page.
Value: The value you’d like to use to replace your ad hoc merge field
All that’s left is putting them together. There are a few characters you need to add to your link to string your parameters together:
? – This will go at the end of your URL. It should go directly after your top level domain — don’t add a “/” at the end.
+ – This will replace the spaces of your field names.
= – This matches your field name to your merge field.
& – This can be used to add multiple fields in your URL.
Follow these instructions to put it all together:
- Start with your URL, and add “?” at the end of it: https://slurpeestoburpees.com/cardio?
- Add your ad hoc field names: https://mysalespage.org?int
- If your ad hoc field name includes spaces, replace them with “+.”
- If your value includes spaces, replace them with “+.”
Using your custom links
Once you’ve created your links containing ad hoc merge fields, you’re ready to implement them.
If you want to use your links in an email, you need to hyperlink them in your message.
If you’re going to prefill form fields or hidden form fields with your ad hoc values, follow the steps in this article.
- Always use the “set manually” option with ad hoc merge fields.
Use ad hoc merge fields to show/hide content
Another helpful way to use ad hoc merge fields is to show/hide content. To do this, you’ll use the “Only show this block if the page URL contains specific text” display option on your block display settings.
This is a helpful way to customize your visitors’ experiences based on their activity on your site, even if they haven’t opted in.
For example, imagine you have a page with links to all the states where you’re running events. When a visitor clicks on your “Washington” link, it adds an ad hoc merge field in your URL. If that URL sends visitors to your “Events” page, your page will display only the Washington events.