Framework Guides

Contentful

Contentful is headless, so the Ours Privacy Web SDK is installed in the front-end application that renders your Contentful content.

Ours Privacy works with Contentful. Because Contentful is headless, the install happens one level away from the CMS.

Contentful stores and delivers content through an API. It does not render your pages, so there is no head field in Contentful to paste a tracking snippet into. The Ours Privacy Web SDK goes into the front-end application that fetches from Contentful and renders your site.


Find Your Front End First

The question to answer is not "how do I install on Contentful" but "what renders my Contentful site." Ask whoever owns your front-end repository, then follow the matching guide:

Once the snippet is in your front end, every page it renders is tracked, including all content served from Contentful.


Tracking Content Metadata

A common goal with a headless setup is reporting on content attributes that live in Contentful, such as a content type, category, or author. Pass them as event properties from your front end when the page renders:

ours('track', 'Article Viewed', {
  content_type: 'blog_post',
  category: 'compliance',
});

Because your front end already has the Contentful entry in hand at render time, no extra API call is needed.


Preview and Draft Environments

Contentful preview builds usually run on a separate hostname. Decide whether you want tracking there. Sending preview traffic to the same Ours Privacy source mixes internal editorial activity into your reporting, so most teams exclude it. See Custom domains for aligning installs to specific hostnames.


Next Steps

If you need further assistance, contact us at support@oursprivacy.com.

How is this guide?

On this page