Contentful Personalization & Analytics
    Preparing search index...
    • Analytics Component

      Tracks views of non-personalized Contentful entry components (content entries in your CMS). This component automatically tracks component views when the entry meets visibility and time thresholds.

      Important: "Component tracking" refers to tracking Contentful entry components, NOT React Native UI components. The term "component" comes from Contentful's terminology for content entries.

      Use this component for standard Contentful entries you want to track views on (products, articles, etc.) that are NOT personalized. For personalized entries, use the <Personalization /> component instead.

      Parameters

      Returns Element

      import { Analytics } from '@contentful/optimization-react-native'
      import { createClient } from 'contentful'

      const contentful = createClient({ ... })
      const productEntry = await contentful.getEntry('product-123')

      <ScrollProvider>
      <Analytics entry={productEntry}>
      <ProductCard
      name={productEntry.fields.name}
      price={productEntry.fields.price}
      />
      </Analytics>
      </ScrollProvider>
      <Analytics
      entry={articleEntry}
      viewTimeMs={1500} // Track after 1.5s visible
      threshold={0.9} // Require 90% visibility
      >
      <ArticleCard data={articleEntry.fields} />
      </Analytics>
      • Must be used within an OptimizationProvider
      • Must be used within a ScrollProvider
      • Tracks only once per component instance
      • Default: tracks when 80% visible for 2000ms
      • Sets variantIndex to 0 (indicates non-personalized/baseline content)
      • Sets experienceId to undefined (no personalization active)

      Personalization for tracking personalized entries