Watch our biggest AI launch event

Announcing Visual Copilot - Figma to production in half the time

Builder.io logo
Contact Sales
Platform
Developers
Contact Sales

Blog

Home

Resources

Blog

Forum

Github

Login

Signup

×

Visual CMS

Drag-and-drop visual editor and headless CMS for any tech stack

Theme Studio for Shopify

Build and optimize your Shopify-hosted storefront, no coding required

Resources

Blog

Get StartedLogin

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:

  1. The BuilderComponent from the @builder.io/react package renders a piece of Builder content.
  2. The model is specified as "page", but this could be any model type in the Builder Space.
  3. The contentLoaded callback triggers when the Builder content finishes loading.
  4. 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.
  5. 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.

Was this article helpful?

Product

Visual CMS

Theme Studio for Shopify

Sign up

Login

Featured Integrations

React

Angular

Next.js

Gatsby

Get In Touch

Chat With Us

Twitter

Linkedin

Careers

© 2020 Builder.io, Inc.

Security

Privacy Policy

Terms of Service

Newsletter

Get the latest from Builder.io

By submitting, you agree to our Privacy Policy

Product

Platform Overview

Integrations

What's New

Open Source

Builder

Builder

Mitosis

Mitosis

Qwik

Qwik

Partytown

Partytown

Popular Guides

From Design to Code Guide

Composable Commerce Guide

Headless CMS Guide

Headless Commerce Guide

Composable DXP Guide

Design to Code

Resources

Blog

Knowledge Base

Community Forum

Partners

Templates

Success Stories

Showcase

Resource Center

Frameworks

React

React

Next

Next.js

Qwik

Qwik

Gatsby

Gatsby

Angular

Angular

Vue

Vue

Svelte

Svelte

Remix logo

Remix

Nuxt

Nuxt

Hydrogen

Hydrogen

See All

© 2024 Builder.io, Inc.

Security

Privacy Policy

SaaS Terms

Security & Compliance

Cookie Preferences