Mailchimp embedded forms can carry GA Connector attribution data into your audience, so every new contact arrives with UTM information, geolocation, referral data and Google Analytics identifiers already attached. What you need to set up depends on which GA Connector integration type your account uses.
Not sure which one you have? Start here: How to Check Which GA Connector Integration Type You’re Using.
API-based integration
There is nothing to configure on the Mailchimp side. The GA Connector script already captures the email address submitted through your form, and the attribution data is synced to your CRM a few minutes after the contact is created. Skip the rest of this article.
Cookie-based integration
Cookie-based integration writes attribution data into hidden fields on your form at the moment of submission. Mailchimp stores those values as merge fields on the contact, so you need to create the fields first, then add them to your embedded form.
Step 1: Replace the GA Connector script on your website
The standard GA Connector script fills hidden fields that match GA Connector’s own field names. Mailchimp uses merge tags instead, and those tags are capped at 10 characters, so the script below fills both naming conventions. Replace your existing GA Connector script with this version on every page.
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
<script data-cfasync="false" type="text/javascript" src="https://tc.gaconnector.com/gaconnector.js"></script> <script> function setGaconnectorHiddenFields() { var gaFields=gaconnector.getCookieValues(),GAC_TAGS={ga_measurement_id:"GAC_GA4MID",ga_client_id:"GAC_GA4CID",ga_session_id:"GAC_GA4SID",gclid:"GAC_GCLID",fc_source:"GAC_FCSRC",lc_source:"GAC_LCSRC",fc_medium:"GAC_FCMED",lc_medium:"GAC_LCMED",fc_campaign:"GAC_FCCMP",lc_campaign:"GAC_LCCMP",fc_term:"GAC_FCTRM",lc_term:"GAC_LCTRM",fc_content:"GAC_FCCON",lc_content:"GAC_LCCON",fc_landing:"GAC_FCLND",lc_landing:"GAC_LCLND",fc_channel:"GAC_FCCHN",lc_channel:"GAC_LCCHN",fc_referrer:"GAC_FCREF",lc_referrer:"GAC_LCREF",fc_timestamp:"GAC_FCTS",lc_timestamp:"GAC_LCTS",ip_address:"GAC_IPADDR",city:"GAC_CITY",country:"GAC_CNTRY",country_code:"GAC_CCODE",region:"GAC_REGION",time_zone:"GAC_TZ",latitude:"GAC_LAT",longitude:"GAC_LNG",OS:"GAC_OS",device:"GAC_DEVICE",browser:"GAC_BROWSR",all_traffic_sources:"GAC_ALLSRC",pages_visited_list:"GAC_PGLIST",page_visits:"GAC_PGVIS",time_passed:"GAC_TPASS"},mailchimpFields={};for(var fieldName in gaFields)mailchimpFields[GAC_TAGS[fieldName]]=gaFields[fieldName];var mergedFields={...gaFields,...mailchimpFields}; for (var fieldName in mergedFields) { var selectors = 'form input[name="' + fieldName + '"], form input#' + fieldName + ', form input#field_' + fieldName + ', form input[name="' + fieldName.toLowerCase() + '"], form input#' + fieldName.toLowerCase() + ', form input#field_' + fieldName.toLowerCase() + ', input[value="gaconnector_' + fieldName + '"],'; selectors += 'form textarea[name="'+fieldName+'"], form textarea#'+fieldName+', form textarea#field_'+fieldName + ', form textarea[name="'+fieldName.toLowerCase()+'"], form textarea#'+fieldName.toLowerCase()+', form textarea#field_'+fieldName.toLowerCase()+', form textarea.'+fieldName+', form textarea[name="param['+fieldName+']"]'+", form textarea[id^='field_"+fieldName+"']"; var inputs = document.querySelectorAll(selectors); if (inputs === null) { continue; } else if (typeof inputs.length === 'undefined') { inputs.value = mergedFields[fieldName]; } else { for (var i = 0; i < inputs.length; i++) { inputs[i].value = mergedFields[fieldName]; } } } } gaconnector.setCallback(setGaconnectorHiddenFields); setInterval(setGaconnectorHiddenFields, 1000); </script> |
Step 2: Decide which fields you need
Heads upA Mailchimp audience holds a maximum of 30 fields per contact, and five of those are taken by the default fields. On a Premium plan the limit is 80. GA Connector offers 36 data points, so on most plans you cannot add all of them. Pick the ones you will actually segment or report on.
A workable starting set is First Click Source, First Click Medium, First Click Campaign, Last Click Source, Last Click Medium, Last Click Campaign, Google Click Identifier, Google Analytics CID and First Click Landing Page. That covers attribution for most reporting without spending your whole field budget.
Step 3: Create the fields in Mailchimp
Click Audience, choose your audience if you have more than one, then click the horizontal three-dot icon and choose Audience fields and merge tags. For each field you want, click Create a new field and fill in the modal:
- Enter a name for the field. This is the label, and it is yours to choose.
- Set Data type to Text.
- Enter the merge tag from the table below.
- Leave the required checkbox unchecked.
- Click Save.
NoteThe field name is yours to choose, but the merge tag has to match the table below exactly. The script looks up fields by merge tag, not by label. Mailchimp merge tags allow uppercase letters, numbers and underscores only, up to 10 characters, which is why the GA Connector tags are abbreviated.
Leave the fields visible on your signup forms. A field hidden at the audience level will not appear in the generated embed code, and the script has nothing to fill. You hide them with CSS in step 5 instead.
| Label | Input ID | Label | Input ID |
|---|---|---|---|
| All Traffic Sources | GAC_ALLSRC | Last Click Campaign | GAC_LCCMP |
| Browser | GAC_BROWSR | Last Click Channel | GAC_LCCHN |
| City (from IP address) | GAC_CITY | Last Click Content | GAC_LCCON |
| Country (from IP address) | GAC_CNTRY | Last Click Landing Page | GAC_LCLND |
| First Click Campaign | GAC_FCCMP | Last Click Medium | GAC_LCMED |
| First Click Channel | GAC_FCCHN | Last Click Referrer | GAC_LCREF |
| First Click Content | GAC_FCCON | Last Click Source | GAC_LCSRC |
| First Click Landing Page | GAC_FCLND | Last Click Term | GAC_LCTRM |
| First Click Medium | GAC_FCMED | Last Click Timestamp | GAC_LCTS |
| First Click Referrer | GAC_FCREF | Longitude | GAC_LNG |
| First Click Source | GAC_FCSRC | Latitude | GAC_LAT |
| First Click Term | GAC_FCTRM | Number of Website Visits | GAC_PGVIS |
| First Click Timestamp | GAC_FCTS | Operating System | GAC_OS |
| Google Analytics CID | GAC_GA4CID | Device | GAC_DEVICE |
| Google Analytics Measurement ID | GAC_GA4MID | Region | GAC_REGION |
| Google Analytics Session ID | GAC_GA4SID | Pages Visited | GAC_PGLIST |
| Google Click Identifier | GAC_GCLID | Time Spent on Website | GAC_TPASS |
| IP Address | GAC_IPADDR | Time Zone | GAC_TZ |
Step 4: Add the fields to your embedded form
Click Forms, then Other forms, then Create new form and Create embedded form. Name the form, choose your audience, and click Continue to builder.
On the Form Fields tab, add the GA Connector fields you created. Click Continue, then Copy Code and paste the code onto your site.
Step 5: Hide the GA Connector fields
The generated form displays every field you added, which is not what you want for attribution data. Add this style block at the start of your embed code to hide them from visitors while leaving them in the form for the script to fill.
|
1 2 3 4 5 |
<style> .mc-field-group:has(input[name*="GAC_" i]) { display: none !important; } </style> |
Check that it works
Visit a page with the form using a URL that carries UTM parameters, submit a test entry, then open that contact in your Mailchimp audience. The GA Connector merge fields should be populated with source, medium, campaign and the rest of the data you enabled.

