Skip to main content
menu_icon.png

Everything you need to switch from Optimizely Classic to X in one place: See the Optimizely X Web Transition Guide.

x
Optimizely Knowledge Base

Behaviorally targeted audiences: Group visitors by action in Personalization

RELEVANT PRODUCTS:
  • Optimizely X Web Personalization

THIS ARTICLE WILL HELP YOU:
  • Target experiences to specific audiences based visitor behaviors, in real time
  • Create audiences based on what visitors do on your site

In Optimizely X Web Personalization, you can deliver tailored experiences to specific groups of visitors on your site, based on their behaviors.

For example, let's say we want to behaviorally target an audience called "Luxury Travelers." Luxury travelers are visitors who purchase bags over $200 in the last 30 days.

Targeting this audience in Personalization takes only a few steps: 

  • First, create page in Optimizely that targets product details for bags.

  • Then set up an add-to-cart event for bags.

  • Finally, add price and subcategory tags to tell Optimizely when a visitor purchases bags of a certain value.

You can find more detail on all the steps listed above in this article.

In order to create a behaviorally targeted audience, you'll first need to set up a page. Then, add events and tags on that page.

Now, we can target this specific behavior by creating a "Luxury Travelers" audience in Personalization.

Here's a video walkthrough of the whole process. Or read on for a step-by-step explanation below.

 

 

Set up the audience

Follow these steps to set up a "Luxury Travelers" audience for visitors who have purchased bags priced at over $200 in the last 30 days.

  1. Navigate to the Audiences dashboard. Click Create New Audience.

  2. Name the audience "Luxury Travelers." 



    Under Visitor Behaviors in Audience conditions, select the "Added to Cart" condition. Then, add filters based on the Price and Subcategory tags.

  3. Click Save Audience.

Technical Details

Behavioral Events and Browser Local Storage

Optimizely stores events triggered by a visitor in their browser's local storage.  This allows behavioral audience conditions to be evaluated in real time as soon as the snippet is downloaded from our CDN and without requiring a separate targeting request.

These events can be accessed directly via the behavior JavaScript API.  This facilitates several valuable use-cases, including:

  • Directly access values stored in event tags and use them in your variation code.  For example, you might configure an event which tracks product detail page views.  You could capture the URL of the product image using a tag.  Then, create a Personalization campaign on the homepage which uses the behavior API to access the product image tag from the most recent product detail page view event and displays the image in a promotional message.
  • Use Custom JavaScript audience conditions to target complex user behaviors not supported in the audience builder.  For example, let's say you configure an event which tracks article views.  You collect the category of the article using a tag.  You want to target visitors who have viewed articles in at least three distinct categories.  You can use the behavior API to count the number of unique values for the category tag as part of a Custom JavaScript audience condition, and use the audience to control your campaign.  See here for details on advanced queries supported by the behavior API.

Optimizely will retain up to 1,000 events per visitor in local storage.  If a visitor triggers more than 1,000 events without clearing their local storage keys, Optimizely will drop old events to make room for new events.

Behavioral Audiences and Campaign Activation Timing

Behavioral audiences are evaluated immediately each time the Optimizely snippet activates, typically on initial page load. This means that only those events which occurred prior to page load will be used to calculate a visitor's membership in any behavioral audiences used by experiments and campaigns which subsequently activate on that page.

Let's say you create an audience called "Article Junkies" which uses the condition "Visitor converted on Viewed Article at least 2 times in the last 7 days". You use this audience to target a personalized experience which will be displayed on all article pages. You should expect that under these conditions, the campaign will not activate until a visitor views their third article. Why? Here's how it works:

  1. Visitor views an article page and triggers a Viewed Article event.

  2. Visitor views a second article page. When the page loads, Optimizely checks  behavior, sees one Viewed Article event, and decides the visitor is ineligible for the personalization campaign. A second Viewed Article event is now triggered.

  3. Visitor views a third article page. When the page loads, Optimizely checks behavior, sees two Viewed Article events, and decides that the visitor is eligible for the personalization campaign. A third Viewed Article event is triggered

If necessary, you can force Optimizely to re-evaluate behavioral audiences after initial page load via the activate JavaScript API method.