Connect HubSpot and Mida can show an A/B test or a personalization only to the contacts you choose, by list or contact property. You sign in to HubSpot once and add a short piece of text to the links in your HubSpot marketing emails. There is no code to add to your site and no key to copy.
It also works the other way: Mida can save a survey answer, or any other attribute you choose, onto the contact in HubSpot.
Plan: targeting by HubSpot audience needs a paid Mida plan. It works with every HubSpot plan, including free.
Note: the HubSpot page in Mida also sends experiment events to HubSpot from your visitors' browsers. That part needs the HubSpot tracking code and custom behavioral events, and it is described on the page's Info tab. Everything in this article works without it.
How it works
The short version: you add ?md_hs={{ contact.email }} to the links in your HubSpot emails. HubSpot fills in the contact's email when it sends. When they click through, Mida looks the contact up in your HubSpot account and saves their lists and the properties you picked on their Mida visitor. Your targeting rules then read those values.
A finished link looks like this before HubSpot sends it:
https://yoursite.com/pricing?md_hs={{ contact.email }}
After the visitor lands, Mida removes md_hs from the address bar. It keeps only HubSpot's contact ID in the browser, never the email address.
What Mida copies
Data | What is copied | Name in Mida |
Lists | Every contact list in your account, active and static, saved as true when the contact is a member and false when they are not. Always on. |
|
Contact properties | Only the properties you tick. |
|
List names are turned into lower case with underscores, so "Trial Users" becomes hubspot_list_trial_users. Properties use HubSpot's internal name, which is lower case and can differ from the label you see. You do not have to work these out. Mida lists the exact name next to each one, and you can click it to copy.
Text, number, dropdown, checkbox, date and phone properties are offered. Hidden properties are not. A dropdown property arrives as its internal value, which can differ from its label. For example, the Lifecycle stage "Lead" arrives as lead.
When targeting applies
Targeting applies from the visitor's next page view, not the page they land on from the email. The lookup runs in the background so it never slows your page or delays a test.
Mida keeps a person's data for up to 6 hours before asking HubSpot again. A change you make in HubSpot can take that long to show up in Mida.
Mida remembers the person in that browser, so they stay recognized on later visits. Another browser or device needs its own click from an email.
Visitors who never clicked one of your HubSpot emails, and whom HubSpot's own script has not identified on your site, stay anonymous and do not match any HubSpot rule.
Visitors recognized without an email click
HubSpot's tracking code gives every visitor a token, in a cookie named hubspotutk. When the visitor submits a HubSpot form on your site, HubSpot links that token to their contact. Mida asks HubSpot about the token, so a contact who filled in a form is recognized from their next page view without clicking an email.
This needs the HubSpot tracking code on your site, and the HubSpot integration turned on in Mida.
Mida checks once per browser session. Most visitors are not contacts yet, so a token that names nobody is not asked about again for a week. These checks use a small share of Mida's HubSpot budget, so email clicks always come first.
Mida keeps only HubSpot's contact ID in the browser, never an email address.
An ID from an email link always comes first. With Strict Consent Mode, Mida waits for consent before reading anything.
Before you start
You need to be an Owner or Admin in Mida.
In HubSpot, you need permission to install apps. Super admins have it. Other users need the App Marketplace access permission.
Make sure the Mida tag is installed on the pages your emails link to.
Connect HubSpot
In Mida, open Integrations and choose HubSpot.
Click Enable HubSpot Integration, then open the Config tab.
Click Connect to HubSpot. HubSpot opens and asks which account to connect. Choose it.
Review what Mida asks for and click Connect app. Mida asks to read your contacts, lists and contact property settings, and to update contacts so it can save the attributes you choose.
HubSpot may then say that Mida's app is not yet verified by HubSpot and ask you to type "I accept the risk". Type it and click Connect.
You are taken back to Mida, which shows Connected with your HubSpot account number. Tick the properties you want to use under Attributes to bring in, then click Save attributes. You can pick up to 40.
Lists need no setup: all of them are brought in. If HubSpot's access ever stops working, Mida shows the error on the Config tab, and Reconnect signs you in again without losing your settings.
Add the ID to your email links
In each HubSpot email or automation, add this to the end of every link that goes to your site:
?md_hs={{ contact.email }}
If the link already has a
?in it, start with&instead of?.If the link ends with a
#sectionpart, put the text before the#.You can copy the exact text from the HubSpot Config tab in Mida.
It only works on links in emails HubSpot actually sends. In a preview the value is usually not filled in.
HubSpot replaces
{{ contact.email }}with the contact's email address. Type it at the end of the link's URL in the email editor's link dialog.
To keep email addresses out of your links, you can use the contact's record ID with ?md_hs={{ contact.hs_object_id }} instead.
Target a test or a personalization
Open your test and go to Targeting.
Add a Segment rule.
In the attribute field, type the name from the HubSpot Config tab.
Choose a condition and a value, then save.
You want to reach | Attribute | Condition | Value |
Contacts in your "Customers" list |
| Is true | |
Known contacts who are not in "Customers" |
| Is false | |
Contacts whose lifecycle stage is Lead |
| Is equal to | lead |
Everyone Mida has recognized from HubSpot |
| Exists |
A few things to know about conditions:
To target people who have something use Is true. To target known contacts who do not have it use Is false.
Anonymous visitors never match one of these rules, including "Is false" and "Does not exist". Mida knows nothing about them, so it leaves them out.
Text conditions are case sensitive. "Pro" and "pro" are different values.
All values arrive as text. Number and date conditions still work as long as the value looks like a number or a date.
For the full list of conditions, see How to use Segment & Event Filtering.
Send Mida attributes to HubSpot
Mida can also save attributes onto the matching contact in HubSpot. The usual case is a survey: a visitor answers "What is your team size?" on your site, and the answer is saved on their HubSpot contact, where your emails and automations can use it.
There is nothing extra to connect. HubSpot is written with the same sign-in.
In HubSpot, create a contact property for each attribute you want to receive, if it does not exist yet (Settings, Properties). Note its internal name, which HubSpot shows when you create it, for example
team_size.In Mida, open the HubSpot Config tab. Under Send Mida attributes to HubSpot, tick the attributes you want to send, then click Save. You can pick up to 20.
What you can pick from
Survey answers: every question with Save the answer to the visitor turned on, shown with the question and its survey.
Attributes on your visitors: names Mida has seen on your recent visitors, for example ones you set with
mida.identify(), with how many visitors carry each.If an attribute has not reached a visitor yet, type its name in Not listed? and click Add.
The name must be the internal name of a contact property that already exists in HubSpot. A name with no matching property is skipped, and so are read-only and calculated properties.
How it behaves
It is only sent for visitors Mida has recognized from one of your HubSpot emails. Anonymous visitors are never sent.
If a visitor answers first and is recognized later, the answer is sent as soon as they are recognized.
Nothing is sent until a name is on the list. Mida never sends an attribute you did not list.
Mida never creates a new contact in HubSpot. It only updates ones that already exist.
The same value for the same contact is sent once an hour at most.
A value overwrites whatever was there before.
To stop, untick everything and click Save.
Test that it works
Pick a list that applies to you, and create a test that targets it.
Add the link text to an email and send it to yourself as a real send, not a preview.
Before you click, hover over the link in your inbox. You should see
md_hs=followed by a real value. If you see the placeholder text instead, HubSpot did not fill it in.Click the link in a normal browser window. Mida removes
md_hsfrom the address bar once the page loads.Go to another page on your site, or reload. You should now be in the test.
Privacy and consent
Mida copies only what is listed above and the properties you tick. Nothing else is read into Mida.
In the other direction, Mida sends HubSpot only the attributes you list under Send Mida attributes, and only for recognized visitors.
The values are saved on the visitor in Mida and used for targeting only. They are not sent back to the visitor's browser.
If you use Strict Consent Mode, Mida does not read or store the contact ID until the visitor gives consent. If consent is withdrawn, the stored ID is removed from the browser.
Mida never creates a visitor from a HubSpot lookup, so this does not add to your monthly tracked users.
Mida never sees your HubSpot password. HubSpot gives Mida an access token, which is encrypted at rest.
When you disconnect, Mida deletes its access and asks HubSpot to revoke it. Values already saved on visitors stay there, but they are no longer refreshed. You can also remove Mida in HubSpot under Settings, Integrations, Connected Apps.
Limits
Limit | Value |
Fields you can bring in | 40 per project |
Length of a field value | 200 characters. Longer values are cut. |
Lists in your account that Mida tracks | 200 |
How long a contact's data is reused before Mida asks HubSpot again | Up to 6 hours |
New contacts Mida looks up | About 120 a minute |
Attributes you can send to HubSpot | 20 per project |
HubSpot limits how many requests an app can make for each account, and Mida stays well under that. Right after a large send, some visitors may be recognized a page view or two later than usual.
Troubleshooting
What you see | What to check |
HubSpot says you do not have permission to install the app | Ask a HubSpot super admin to connect, or to give you the App Marketplace access permission. |
"The HubSpot sign-in expired or was already used" | Click Connect to HubSpot again and finish within 10 minutes. |
"HubSpot connection was cancelled" | You clicked Cancel in HubSpot. Start again when you are ready. |
The link in my inbox shows | The email was a preview, or the text was typed outside the link's URL. Put it at the end of the URL and send a real email. |
I clicked the email but I am not in the test | Targeting starts on the next page view. Load a second page. Also check the link had |
A property I need is not in the list | Hidden properties, and properties that are not text, number, dropdown, checkbox, date or phone, are not offered. Otherwise contact us in the chat. |
A dropdown rule never matches | Compare against the internal value, not the label. In HubSpot, the property's settings show each option's internal value. |
A survey answer is not showing up in HubSpot | Check that a contact property with that internal name exists and is not read-only, that it is ticked under Send Mida attributes, and that the visitor clicked one of your HubSpot emails in that browser. |
"HubSpot access was removed. Reconnect HubSpot to continue." | HubSpot stopped accepting Mida's access, for example because the app was removed in HubSpot. Click Reconnect on the Config tab. |
I changed a contact in HubSpot and Mida has not noticed | Mida reuses a contact's data for up to 6 hours, and the list of lists and properties for 10 minutes. |
FAQ
Does this work for visitors who never opened my emails?
Only if HubSpot's own script identified them on your site, as described in "Visitors recognized without an email click". Everyone else is anonymous until they click a link from one of your HubSpot emails.
Do I need to change my emails?
Yes. HubSpot does not put a usable contact ID on links by itself, so you add the short text above to your links.
Will it slow down my site?
No. The lookup happens in the background after your page and your tests have loaded.
Can I connect more than one email platform?
Yes. A project can connect several, for example HubSpot as your CRM and another tool for email. Each is connected and set up on its own card. A visitor recognized by more than one gets each platform's data side by side, and an attribute you send goes to every platform that lists it.
