Showing or hiding embedded video players based on consent
-
I am wondering if there’s any straightforward way to manage the code for embedded media players from services like YouTube and Vimeo so that that code only runs based on a consent setting from one of the various cookie consent plugins, and/or based on browser Do Not Track settings. I’ve seen a number of non-WordPress websites implement something like this, but I don’t know if it’s possible for WordPress.
Here’s the kind of functionality I’m thinking of:
Let’s say I place the code for the embedded player in a post or page. When someone visits that page, I would like the website to check whether the visitor has recorded the appropriate consent from the cookie consent plugin (typically stored in a cookie). If they do NOT have the appropriate consent, I would like the embedded player to not load at all and instead display some kind of message to the effect of “This embedded video player has been hidden due to your current privacy settings. To adjust your settings, please …” (and then present the appropriate instructions for changing the settings). If the visitor DOES have the appropriate consent, the player would load normally.
(I am assuming for the sake of discussion that I already have some means of recording and storing the appropriate consent that can be passed to whatever wrapping function controls the loading of the media player. That part is already solved.)
I know this is possible with widgets, using Widget Logic, or with header/footer scripts, but I have no idea how to implement this for players or IFrames within in a post or page. Are there tutorials on how to do this? Are there plugins that can streamline it? Is this feasible with caching?
(The obvious motivation for doing this is to improve visitor privacy with embedded content, since the embedded player immediately gathers some information about the user as soon as the player loads — and may place its own cookies, LSOs, etc. — even if the visitor doesn’t actually use or interact with the player. I would like to give users the option to just not load that content if they prefer.)
- The topic ‘Showing or hiding embedded video players based on consent’ is closed to new replies.