Vimeo DNT Flag

Do not track flag on embedded Vimeo video

It is possible to embed a Vimeo video in a Rich Text field. When you paste the URL into the builder then the builder UI goes away and makes an oEmbed request to Vimeo to capture the player markup. This markup then gets sent to the app and is rendered directly to the client.

The problem is that the default player markup drops cookies and the user may not have given their consent for this. It is possible to pass a “do not track” flag to the player oEmbed call which then returns player markup which does not drop cookies. The problem is that the builder UI does not allow the possibility to do this.

How can we render a Vimeo video without the player dropping cookies? Can we render custom markup ourselves or do we have to build a dedicated video slice where we build out own player?

These are the Vimeo docs: Vimeo

Hi @johnanthony.dudmesh,

Welcome to the community! So we have two approaches to embed fields, either its own field, or within rich text. You have therefore two options to handle this on your end:

  • Keep it within the rich text field, and use custom components to control the behavior of the embed: Rich Text — Prismic Docs , which should then let you decide what to do with cookies, autoplay, etc.
  • Make it an embed field, as such: Embed — Prismic Docs, where you can also have more control over its settings.

The embed field is more straightforward, but gives you less flexibility compared to a custom component in a rich text field, so it’s up to you!

One option for Vimeo: don't render the oEmbed html from Prismic as-is, but build the iframe yourself from the embed's embed_url and append Vimeo's dnt=1 player parameter.

Rough idea in a rich text / embed component:

const url = new URL(embed.embed_url);          // e.g. https://vimeo.com/123456789
const id = url.pathname.split('/').filter(Boolean).pop();
const src = `https://player.vimeo.com/video/${id}?dnt=1`;
// render <iframe src={src} allow="autoplay; fullscreen; picture-in-picture" ... />

dnt=1 tells the Vimeo player not to set tracking cookies or collect session analytics, so the player can be shown before consent. If you want to be stricter, you can also render only the thumbnail (thumbnail_url from the oEmbed data) and swap in the iframe after the user accepts cookies or clicks play.

The editor UI will still do its own oEmbed lookup when you paste the URL, but that only happens for editors in the Page Builder, not for your site visitors.