This article covers the following: |
Overview
Building upon VWO’s personalized text capabilities that leverage variables and embedded JavaScript (EJS) syntax to display dynamic, visitor-specific content, this extension introduces a new variable type: Event-driven variables. This variable enables displaying how many unique visitors performed a specific action tracked by your event system in the past X days (e.g., “iPhone 15 purchased by X users in the last 5 days”).
Customers can incorporate this powerful variable into their variation texts to create highly relevant, socially validated, and conversion-optimized visitor experiences.
Key Benefits
- Display dynamic counts of visitors who triggered specific events recently to build urgency and social proof.
- Enhance personalized experiences beyond visitor-level data by using aggregate visitor behavior.
- Empower marketers and testers to use event-driven insights without developer dependency.
- Easily configured in the VWO Editor similar to existing personalized text variables.
How It Works
Variable Definition
Define an event-based variable that tracks visitor actions over a configurable time period using your event system. The variable exposes a count of visitors who performed a target event (e.g., “purchase iPhone 15”) within a configurable retrospective window (e.g., last 7 days).
Using the Variable in VWO Editor
- Once you declare the variable in VWO, you can use the variable in the Edit element/Edit HTML operation.
- VWO editor supports Embedded JavaScript (EJS) syntax <%= %> to inject the variable in text/HTML.
- Use conditional statements to customize messaging based on count thresholds.
Test and Validate
Preview the campaign ensuring the variable populates correctly and the conditional logic renders as expected.
Example Scenario
In an e-commerce website, you can display the number of users who bought the product or number of users who viewed the product or some bestselling product all using event-driven variable.
For example, consider an e-commerce website, abc.com, where a visitor, John, navigates to the iphone 15 page - https://www.abc.com/iphone15. You can show him a nudge along the lines of:
X users purchased this product in the last 5 days
To achieve this, you can do the following in the VWO campaign editor:
-
In the Edit element/Edit html operation, select the variable. For example, PurchaseCount contains the count of purchases for the last 5 days. Next, add the text:
<h2><%= PurchaseCount%> users purchased this product in the last 5 days!</h2>
-
Optionally, you can use the variable in conditions to enhance messaging:
<% if (PurchaseCount > 100) { %> <h2>Hurry! Over <%= PurchaseCount %> users bought iPhone 15 this week!</h2> <% } else { %> <h2>Be among the first <%= 100 - PurchaseCount %> to buy the iPhone 15!</h2> <% } %>
Caveats
- Make sure that any event properties used in filters (for event or on-page variable input) are present on the page before campaign execution to avoid unresolved or incorrect counts.
- Handle cases where the returned count is zero or data is unavailable gracefully in the variation content.
Need more help?
For further assistance or more information, contact VWO Support.