Skip to main content

Optimizely Installation and Usage

  • Updated

 This article will help you:

  • Enable the Demandbase integration in Optimizely
  • Create new audiences using the Demandbase integration

The Demandbase integration creates targeted B2B audiences for delivering personalized content to the companies you care about the most. Demandbase's technology allows you to do this on the very first visit to your website, before these companies have even identified themselves to you.

Enabling Demandbase in Optimizely

To enable Demandbase for a project, go to the Integrations tab on the Home page and toggle the button to On in the right sidebar.

Enter the required API key (alternatively referred to as a ‘token’), which can be provided by your Demandbase Customer Success Manager, and click Save. This will enable the Demandbase integration for your project. Optimizely will deploy the Demandbase tag and fetch visitor data from Demandbase for each page view.

Creating a Demandbase Audience

After enabling the Demandbase integration, you can create Optimizely Audiences (or add conditions to an existing Audience) based on company information in Demandbase. To do this, go to the Overview > Audiences tab and click New Audience.

In the Audience builder, go to the Third Party tab. Click on Demandbase to see a full list of targeting conditions and hover over the question mark to see their description. For more information on the attributes, please see this Overview from Demandbase (a Demandbase login is needed to view).

Drag the condition into the Audience Conditions and complete the open fields. You should work with your Demandbase Customer Success Manager on the exact formatting to use for the different fields.

In this example, we created an audience with the following conditions:

Industry = Financial Services
Employee Range = Enterprise
Revenue Range = $2.5B - $5B OR Over $5B

Here is what it looks like in the Audience builder:

Once you have set your audience conditions, click Save Audience.


Activation on first page visit

This integration works by asynchronously loading company data from Demandbase as the page is rendering, and storing the data in the visitor's browser. This means that experiments will trigger only when the visitor comes back to the page, on their second page visit or later.

If you would like to trigger an experiment on first page visit, you can tell Optimizely to wait for company data from Demandbase to load using Conditional Activation. To enable Conditional Activation for an experiment, click Options > Activation Mode in the Editor, then select Conditional.

In the text box, insert the following code which ensures to activate the experiment only after visitor data from Demandbase is available:

function(activate, options) {
// Interval in ms for polling Demandbase visitor data

// Max number of poll attempts

var pollCount = 0;
function poll() {
if (window.optimizely && && && &&
!options.isActive) {
} else if (pollCount < MAX_POLL_COUNT) {
setTimeout(poll, POLL_INTERVAL);


After clicking Apply and saving the experiment, you should now see your experiment trigger on the first page visit.

Note: Conditional activation means that experiment may trigger after all the content on the page has loaded, thus causing flicker. If you want to prevent the experiment from triggering after a certain timeout, you can edit the POLL_INTERVAL and MAX_POLL_COUNT in the conditional activation code above. For example, the current poll interval of 50 and max polls of 5 will ensure that Optimizely will not trigger the experiment after more than 200ms.

Was this article helpful?

2 out of 2 found this helpful