Using Clearbit with Convert Experiences
Leverage Clearbit Data for Precise Convert Experience Targeting and Enhanced Audience Segmentation
THIS ARTICLE WILL HELP YOU:
- Before you start
- Install the Clearbit Reveal tag
- Explore the Clearbit data
- Add the wait helper to your Project Global JS
- Set the Location trigger to wait for Clearbit data
- Create the audience
- Run a QA in your experience
- See your results in Google Analytics 4
- If your plan doesn't include Dynamic Website Triggers (legacy)
Overview
Clearbit Reveal uses IP intelligence to turn anonymous website traffic into company data. If your Clearbit Reveal tag is installed and fills the window.reveal object on your pages, Convert can use that data to target experiences, for example by industry sector.
Clearbit has joined HubSpot, and Clearbit's free tools ended on 30 April 2025. Before you set this up, check with Clearbit or HubSpot that your plan still includes the Reveal tag.
Clearbit data may not be ready when Convert first checks the page, so the experience has to wait for it. The When a callback is called Location trigger starts the experience once the data is there. It replaces the legacy convert_recheck_experiment() token, which is being phased out. The developer docs cover the same switch in Migrate to Dynamic Location Triggers.
Before you start
- Your project must use the current Convert tracking script. The legacy script does not support Dynamic Website Triggers. To switch, see Migrate from the Legacy Tracking Script to the New Tracking Script.
- When a callback is called is one of the Dynamic Website Triggers. If your plan includes Dynamic Website Triggers, follow the steps below. If it doesn't, use the legacy method at the end of this article. The Convert pricing page shows what each plan includes.
- You need a Clearbit plan that includes the Reveal tag.
Install the Clearbit Reveal tag
Use the install code from your Clearbit account, and add the Reveal tag before Convert's tracking code, so the Clearbit data is available as early as possible. To find and install Convert's tracking code, see How to Install the Main Tag / Convert Tracking Code.
Explore the Clearbit data
To check that the tag works and to see the data you can target, open the browser console on one of your pages and run:
window.reveal;
- If it returns
undefined, the Reveal tag is missing from the page or has not loaded yet. - If
companyisnull, Clearbit has not identified this visitor's company, or has not done it yet. Wait a few seconds and run the command again. The experience runs only for visitors whosecompanyis filled in. - Otherwise, open
companyand note the fields you want to target, such ascompany.category.sector.
Add the wait helper to your Project Global JS
In your project, go to Configuration > Global Javascript and add this helper. It checks every 100 ms, up to 50 times (about 5 seconds), for company data in window.reveal.company. If none appears, the helper stops, and the experience does not run for that visitor. You only need to add it once per project.
Save it under All Environments. If one of your environments has its own Global JS, add the helper there too, because that script replaces the All Environments code on that environment.
window.waitForClearbit = ({
nextRetry = 100, // ms
maxRetries = 50,
} = {}) => {
let retries = 0;
const check = (resolve) => {
const reveal = window.reveal;
if (reveal && reveal.company) {
resolve(reveal);
} else if (retries < maxRetries) {
retries++;
setTimeout(() => check(resolve), nextRetry);
} else {
resolve();
}
};
return new Promise((resolve) => check(resolve));
};
Set the Location trigger to wait for Clearbit data
Create your experience and its changes, if you have not done so.
Edit the experience's Location settings, choose When a callback is called as the trigger, and paste this code:
if (options.isActive) return;
window.waitForClearbit().then((reveal) => {
if (reveal && reveal.company) {
activate();
}
});
Convert passes two arguments to the callback: activate, which you call when the experience should start, and options, which includes locationId and isActive. The isActive check stops the callback from running twice. The experience starts only when Clearbit returns company data for the visitor. For more on this trigger, see Targeting Experiments with Dynamic Location Triggers (JS Callbacks).
Create the audience
Say you want to target visitors at companies in the Health Care sector. Edit the experience's audience settings, select New Audience, open the Advanced tab, and add a JS Condition with this code:
(function () {
var company = window.reveal && window.reveal.company;
var category = company && company.category;
return !!category && category.sector === "Health Care";
})()
Replace sector === "Health Care" with the field and value for your segment, using the field names you see in your console. The condition checks each level before it reads it, so it returns false instead of failing when there is no company data.
Add the audience to the experience you want to target, and save.
Run a QA in your experience
On a page with the Reveal tag, paste the condition into the browser console and confirm it returns true for a visitor who should see the experience. Then follow the QA guide to check that the experience runs when it should and stays off when it should not.
See your results in Google Analytics 4
To analyse these experiences in Google Analytics 4, connect your Convert project to GA4. See Integrate Convert Experiences with Google Analytics 4.
If your plan doesn't include Dynamic Website Triggers (legacy)
Without Dynamic Website Triggers, you can use the legacy convert_recheck_experiment() token in the audience condition instead. The token is being phased out. It still works today, but use the callback trigger above if your plan includes Dynamic Website Triggers.
When the condition calls the token, Convert checks the experience again every 50 ms for about 2 minutes, then stops. If the Clearbit data arrives after that, the experience does not run on that page view.
- Install the Clearbit Reveal tag as described above. Skip the wait helper and the callback.
- Keep the Location trigger set to Upon Run.
- Add this JS Condition to the audience:
(function () {
var reveal = window.reveal;
if (!reveal || !reveal.company) {
convert_recheck_experiment();
return false;
}
var category = reveal.company.category;
return !!category && category.sector === "Health Care";
})()
Keep convert_recheck_experiment(); on its own line, as shown. The condition calls it only while window.reveal has no company data. Once it has, the condition returns true or false and the re-checks stop.
If your plan later includes Dynamic Website Triggers, move to the callback: add the wait helper, change the Location trigger to When a callback is called, replace the condition with the one in Create the audience, and run a QA before you publish the change.