Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create cookies for "Embed Privacy" #282

Closed
saschafoerster opened this issue Aug 22, 2020 · 1 comment
Closed

Create cookies for "Embed Privacy" #282

saschafoerster opened this issue Aug 22, 2020 · 1 comment
Labels
enhancement New feature or request feature-request

Comments

@saschafoerster
Copy link

In WordPress, we are using "Embed Privacy" to hide embeddings, until a user explicitly agrees to show them: https://de.wordpress.org/plugins/embed-privacy/

Embed Privacy saves a session-cookie, in which all networks are saved, that are allow in general for this visit: additional networks are added in this cookie.

embed-privacy	{"twitter":true,"instagram":true,"youtube":true,"facebook":true}	test.url.com	/	Session	62 B			

Is it possible to create a cookie for the user: "Allow Social Media Embeddings from Facebook", and create a pre-filled cookie like this:

embed-privacy	{"instagram":true,"facebook":true}	test.url.com	/	Session	62 B			

Of course it might be really difficult to add all the social-networks with a selector by network, like it is done by embed privacy. Or is it possible to create several cookies with the same name? Like this?

embed-privacy	{"facebook":true}	test.url.com	/	Session	62 B			
embed-privacy	{"instagram":true}	test.url.com	/	Session	62 B	

Thanks for the help! :) This issue might be related to #190 as it could be a nice addition to Klaro in WordPress to have more control about cookies set by embeddings.

@adewes adewes added enhancement New feature or request feature-request labels Aug 24, 2020
@saschafoerster
Copy link
Author

Found out!

{
		name: 'embeddings',
		default: false,
		title: 'Social-Media-Embeddings (Facebook, Instagram, YouTube, Twitter)',
		purposes: ['embedding'],
		cookies: [/^embed-.*$/, '/', "." + location.hostname],
		callback: function(consent, app) {
				console.log(
						'Einwilligung für Anwendung ' + app.name + ': ' + consent
				);
				if(consent==true){
							document.cookie="embed-privacy={\"instagram\":true,\"youtube\":true,\"facebook\":true,\"twitter\":true}; path=/; SameSite=Lax";
				 } else {
							document.cookie="embed-privacy={\"instagram\":false,\"youtube\":false,\"facebook\":false,\"twitter\":false}; path=/; SameSite=Lax";
				}

		},
},

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request feature-request
Projects
None yet
Development

No branches or pull requests

2 participants