Smart Tags & Field Mapping
When you create an integration, AFI shows a list of fields from the sender (the form, order, signup, etc.) and asks you to map them onto fields the receiver expects. This page is the complete reference for what you can put into each mapping cell — sender fields, static text, smart tags, UTM tags, ad-platform click IDs, and shortcodes — and how they combine.
How field mapping works
Each row in the mapping table represents one field on the receiver side. The left column is the receiver’s field name (e.g. First Name on Mailchimp, Email on HubSpot). The right column is what AFI will send for that field on every submission. You can put one of three things in the right column:
- A sender field, picked from the dropdown. Whatever the form submits for that field is sent through.
- A static value you type yourself. Useful for tagging every record from this integration — e.g. always send
Source = WordPress contact form. - A smart tag like
{{_date}}or{{utm_source}}that AFI resolves at submission time.
Those three can be combined freely in one cell. For example, mapping a single Note field on the receiver to:
Submitted from {{_site_title}} on {{_date}} (campaign: {{utm_campaign}}, IP {{_user_ip}})
…produces a note like Submitted from Acme Inc. on 2026-05-13 (campaign: spring-promo, IP 198.51.100.23) on every record.
Smart tag categories
AFI ships three groups of smart tags out of the box: system tags (date, IP, site info, post context, logged-in user), UTM tags (campaign attribution captured from the URL), and ad-platform click IDs (Google, Meta, Microsoft, TikTok, LinkedIn). Each group has its own toggle in AFI > Settings > General — see Settings & Administration.
System tags
Always available unless you tick Disable Special Tags in General Settings. Resolved at the moment the submission is processed.
| Tag | Resolves to |
|---|---|
| {{_submission_date}} | The submission timestamp in Y-m-d H:i:s format (site time zone). |
| {{_date}} | Current date in Y-m-d format. |
| {{_time}} | Current time in H:i:s format. |
| {{_weekday}} | Current weekday name (e.g. Wednesday). |
| {{_user_ip}} | Submitter’s IP address. |
| {{_user_agent}} | Submitter’s browser user-agent string. |
| {{_site_title}} | WordPress site title (blogname option). |
| {{_site_description}} | Site tagline (blogdescription option). |
| {{_site_url}} | Site home URL. |
| {{_site_admin_email}} | WordPress admin email. |
| {{_post_id}} | ID of the post/page the form was submitted from. |
| {{_post_name}} | Slug of the host post/page. |
| {{_post_title}} | Title of the host post/page. |
| {{_post_url}} | Permalink of the host post/page. |
| {{_form_id}} | Form ID (when the sender plugin exposes it). |
| {{_form_name}} | Form name / label (when available). |
| {{_user_id}} | Logged-in user’s ID. Empty for anonymous submissions. |
| {{_user_first_name}} | Logged-in user’s first name. |
| {{_user_last_name}} | Logged-in user’s last name. |
| {{_user_display_name}} | Logged-in user’s display name. |
| {{_user_email}} | Logged-in user’s email. |
Heads up — recent rename. The {{_user_*}} family used to be named {{_admin_*}}. The new names better reflect what they actually return: the currently-logged-in user, who on a public form is usually the visitor, not an admin. If you have older mappings referencing {{_admin_email}} etc., update them to {{_user_email}}.
UTM tags & ad-platform click IDs
Tick Send UTM Variables in AFI > Settings > General to enable this group. When enabled, AFI captures the values from the URL query string the first time a visitor lands on your site and stores them in cookies; on submission, those stored values are available as tags. This means a visitor who clicked your Google Ad three pages ago still carries the utm_source=google attribution when they submit the form.
| Tag | Captured from | Typical use |
|---|---|---|
| {{utm_source}} | ?utm_source= | Marketing source (google, facebook, newsletter). |
| {{utm_medium}} | ?utm_medium= | Marketing medium (cpc, email, social). |
| {{utm_campaign}} | ?utm_campaign= | Campaign name. |
| {{utm_term}} | ?utm_term= | Paid keyword. |
| {{utm_content}} | ?utm_content= | Ad variant / A/B identifier. |
| {{gclid}} | ?gclid= | Google Ads click ID. |
| {{gbraid}} | ?gbraid= | Google Ads iOS app click ID. |
| {{wbraid}} | ?wbraid= | Google Ads web click ID. |
| {{dclid}} | ?dclid= | Google Display Network click ID. |
| {{fbclid}} | ?fbclid= | Meta (Facebook / Instagram) Ads click ID. |
| {{msclkid}} | ?msclkid= | Microsoft Ads click ID. |
| {{ttclid}} | ?ttclid= | TikTok Ads click ID. |
| {{li_fat_id}} | ?li_fat_id= | LinkedIn Ads click ID. |
Map these to a CRM field like Original Source or push them into a Google Sheet alongside every submission to attribute leads end-to-end.
Static text + tag combinations
Anywhere you can put a sender field or smart tag, you can also concatenate static text. AFI does the substitution at submission time and sends the merged string. A few common patterns:
- Forced tag:
WP-Form-{{_form_name}}— sendsWP-Form-Contact. - Multi-line note:
{{first_name}} {{last_name}}\n{{email}}\n{{phone}}— newline-separated note in a single CRM field. - Tagged tags (e.g. Mailchimp groups, ActiveCampaign tags):
website, {{utm_source}}, {{utm_campaign}}— three tags from one cell.
Shortcodes
AFI evaluates WordPress shortcodes in mapped fields before sending. This lets you use any shortcode-producing plugin to inject dynamic values. A common example is the Shortcoder plugin for storing reusable snippets, or a custom shortcode that returns the current user’s CRM record ID.
To disable shortcode evaluation for a specific field (rare), see the developer-side adfoin_parse_shortcodes filter.
Required vs optional receiver fields
The mapping panel marks fields the receiver platform considers required (e.g. email on most email tools, contact_name on most CRMs). Leaving a required field blank causes the receiver’s API to reject the request. If a required value isn’t in the form, fill it with a smart tag or static fallback — for example, mapping a CRM’s required Source field to the static string WordPress lead form.
Custom smart tags (developer)
Themes and plugins can add their own tags using the adfoin_special_tags and adfoin_special_tag_value filters. Brief sketch:
// Register the tag in the mapping dropdown
add_filter( 'adfoin_special_tags', function ( $tags, $cat ) {
$tags['my_company_id'] = 'My Company ID';
return $tags;
}, 10, 2 );
// Resolve its value at submission time
add_filter( 'adfoin_special_tag_value', function ( $value, $tag, $user, $post ) {
if ( 'my_company_id' === $tag ) {
return get_user_meta( $user->ID, 'company_id', true );
}
return $value;
}, 10, 4 );
Once registered, {{my_company_id}} appears in every integration’s mapping dropdown.
Troubleshooting
- A tag shows up as the literal text
{{_date}}in the receiver. Special Tags are disabled in General Settings, or the receiver is escaping curly braces. Re-enable the toggle and / or wrap the field in quotes on the receiver side. - UTM tags are always empty. The Send UTM Variables toggle isn’t enabled, or visitors aren’t arriving with the query string set. Test by visiting your site with
?utm_source=testappended, then submitting the form. - Logged-in user tags are empty. The submitter wasn’t logged in.
{{_user_*}}only resolves for logged-in WordPress users. - Shortcode is sent as raw text. The shortcode-producing plugin isn’t active at submission time, or the shortcode handler returns nothing for that context.