If you are using our React SDK, you can easily add data tracking to any data model, which has been well documented already here: A/B testing data models
and here: Adding Insights Tracking for your Data Models with React
But, if you are not using React, or don’t want to use <BuilderContent />
for some reason (though we highly recommend you do!), you can still manually add tracking with our core JS SDK
import { builder } from '@builder.io/sdk';
builder
.get('blog-article'
.promise()
.then(content => {
// Track an impression of this test group content
builder.trackImpression(content.id, content.testVariationId)
});
And you can add any click tracking manually with
Next, make sure you have setup conversion tracking to have conversion tracking data on your appropriate data model.
// E.g. when a purchase occurs for $99.99
builder.trackConversion(99.99);
And to get engagement data, you can also track clicks by calling the builder.trackInteraction
, method, as below
<button
onClick={() => {
builder.trackInteraction(content.id, content.testVariationId);
}}
>
{ctaText}
</button>
Try it out within your app and let us know how it goes!