With Builder, you can capture valuable data about user interactions with content and pass that data to an analytics provider, for example, a Customer Data Platform (CDP). In this way, you can gain insights, build targeted segments, and personalize future content based on user behavior.
To track when a piece of Builder content loads and a user interacts with it, use the contentLoaded
callback on the BuilderComponent
:
import { BuilderComponent } from '@builder.io/react'
<BuilderComponent
model="page"
contentLoaded={(data, content) => {
amplitude.track('builderImpression', {
contentId: content.id,
contentName: content.name,
testVariationId: content.testVariationId,
// Make sure to edit the variant name in Builder with a descriptive name
testVariationName: content.testVariationName
});
}}
/>
Here's what's happening:
- The
BuilderComponent
from the@builder.io/react
package renders a piece of Builder content. - The
model
is specified as"page"
, but this could be any model type in the Builder Space. - The
contentLoaded
callback triggers when the Builder content finishes loading. - Inside the callback, Amplitude's
track
method is used to log an event called'builderImpression'
. Replace this with the tracking method from the CDP of choice. - Several pieces of data about the content are passed as event properties:
contentId
: the unique ID of the content.contentName
: the name given to the content in Builder.testVariationId
: if this content is part of an A/B test, the ID of the specific test variation.testVariationName
: a human-readable name for the test variation (make sure to set this in Builder).
With this in place, every time a piece of Builder content loads, it is logged to the CDP with metadata such as content ID, name, and test variation details. You can then use this data in the CDP to:
- Analyze content performance by measuring metrics like impressions, clicks, and conversions.
- Define user segments based on the specific content pieces they have viewed.
- Personalize future content experiences based on user past viewing behavior.
Tip: You can use Builder's smart targeting in conjunction with a an analytics provider to automatically capture and target audiences based on their behavior. To learn more, visit Smart Targeting and Using Builder with Customer Data Platforms.
The exact capabilities will depend on the features and integrations offered by the chosen CDP.
Once the data is sent to your analytics provider, you can use it for various purposes, such as:
- Analyzing content performance by measuring engagement and conversion metrics.
- Creating user segments based on the content they have viewed for targeted campaigns.
- Implementing content recommendations based on user viewing history.
These are just a few examples but the specific use cases will depend on the capabilities of the chosen analytics provider and your business requirements.
For more ways to leverage your analytics provider with Builder, read Smart Targeting.