Use the Do Not Track parameter in vimeo videos

With this parameter, Vimeo no longer uses cookies that identifies users
browsing our site.

They do still store some cookies, though; quoting from Vimeo player
parameters overview:

> When DNT is enabled, Vimeo deploys one essential cookie via the
> embeddable player:
> The __cf_bm cookie, which is part of Cloudflare's Bot Management
> service and helps mitigate risk associated with spam and bot traffic.

Not sure whether this counts as essential cookies in our case; they're
essential for Vimeo, but for us, they're third-party cookies, after all.

[1] https://help.vimeo.com/hc/en-us/articles/12426260232977-Player-parameters-overview
This commit is contained in:
Javi Martín
2024-05-19 05:15:28 +02:00
parent 442156b1cc
commit ee64efe659
3 changed files with 5 additions and 5 deletions

View File

@@ -43,9 +43,9 @@ class Shared::EmbeddedVideoComponent < ApplicationComponent
def src
if server == "Vimeo"
"https://player.vimeo.com/video/"
"https://player.vimeo.com/video/#{match[2]}?dnt=1"
elsif server == "YouTube"
"https://www.youtube-nocookie.com/embed/"
"https://www.youtube-nocookie.com/embed/#{match[2]}"
end
end
@@ -54,6 +54,6 @@ class Shared::EmbeddedVideoComponent < ApplicationComponent
end
def iframe_attributes
tag.attributes(src: "#{src}#{match[2]}", style: "border:0;", allowfullscreen: true, title: title)
tag.attributes(src: src, style: "border:0;", allowfullscreen: true, title: title)
end
end

View File

@@ -33,7 +33,7 @@ describe Shared::EmbeddedVideoComponent do
it "embeds a vimeo video for vimeo URLs" do
allow(record).to receive(:video_url).and_return "https://vimeo.com/7232823"
embed_url = "https://player.vimeo.com/video/7232823"
embed_url = "https://player.vimeo.com/video/7232823?dnt=1"
render_inline component

View File

@@ -315,7 +315,7 @@ describe "Proposals" do
visit proposal_path(proposal)
within "#js-embedded-video" do
expect(page).to have_css "iframe[src='https://player.vimeo.com/video/7232823']"
expect(page).to have_css "iframe[src='https://player.vimeo.com/video/7232823?dnt=1']"
end
end