Jump to content

PrivacyWire - Cookie Management & async external asset loading


joshua

Recommended Posts

not sure whether a feature request should be dropped here, or @github, but I'll try it here first 😉

First off: I love that module. It's handy, easy to implement/adapt and it just does what it is supposed to do. Thanks for sharing!

What I was looking for is a way to customize the markup of the consent blueprint. For the time being I have edited the original shipped file, but actually it would be great if this file can be configured the same way as the banner. Maybe that's something you could consider in the future as well? 

 

/update

🙂 https://github.com/webworkerJoshua/privacywire/pull/16

  • Like 2
Link to comment
Share on other sites

  • 1 month later...

@joshua I'm using GoogleMapsApi on a page. And did this:
 

<?php

// allow button
echo "<a class='privacywire-consent-button' data-consent-category='external_media'>allow cookies</a>";

	$address = $content->map_address->address;
	$lat = $content->map_address->lat;
	$lng = $content->map_address->lng;
	echo "<script >
		var lat,lng,zoom;
		lat = $lat;
		lng = $lng;
	</script>";	
		
// map stylung and render function
echo "<script type='text/plain' data-type='text/javascript' data-category='external_media'  data-src='{$templatesUrl}scripts/gmaps.js' class='require-consent'></script>";

// maps API
echo "<script type='text/plain' data-type='text/javascript' data-category='external_media' data-src='https://maps.googleapis.com/maps/api/js?key=XXXXXXXXXXXXXXXXXXXXXXXXXXXXX&callback=initMap' class='require-consent'></script>";
	
// my map
echo "<div id='map' class='wrapper'></div>";

When I click on the allow button, all content disappear and there is a error
 

domain.com/:1 Uncaught (in promise) Qe {message: 'Map: Expected mapDiv of type HTMLElement but was passed null …

However the cookies are allowed. So that if refresh the page, everything is fine (cookies allowed and map is shown). What am I missing?

Link to comment
Share on other sites

  • 3 months later...

I stumbled upon another issue: a.f.a.i.k. the IMPRINT and PRIVACY pages should not be covered by this modal.

Otherwise, you cannot read what you are going to decide (if you followed the privacy link in the module, for example). But I am not a lawyer, it is just how I think it should work logically, especially thinking of the very strict German laws about the IMPRINT page accessibility. - Any oppinion?

I am looking for an easy way. Right now, I am using CSS to hide .privacywire and its wrapper on those.

But since the links to those pages are stored in the modules settings, why not excluding them automatically? Just an idea.

In this context, it would be cool if the module did some quick checks to assist the webmaster if those linked pages actually exist and are viewable.

  • Like 1
Link to comment
Share on other sites

  • 2 weeks later...

Has anyone noticed any issues getting this module working in FF?  It seems to work fine in Chrome based browsers but in FF for me - no errors in the console either which seems strange.

Link to comment
Share on other sites

4 minutes ago, netcarver said:

Has anyone noticed any issues getting this module working in FF?  It seems to work fine in Chrome based browsers but in FF for me - no errors in the console either which seems strange.

Did you check your Browser-Settings? DNT-Mode? Ad-Blocker?

  • Like 1
Link to comment
Share on other sites

@ngrmm Thank you for the quick reply.  So I have the checking of DNT set off in the module settings, which should make it ignore the browsers DNT setting (I think).

image.png.533c8d5bd9a7b70a5d6083871eb33601.png
I'll look at other browser/extension settings as I do run ublock origin.

Link to comment
Share on other sites

So it is ublock-origin. Thank you for the pointer - I should have checked that first!

Updated to add 1: I actually run UBO in all my browsers so there must be a settings difference between UBO in my FF and Brave installs - will look into it.

Updated to add 2: Found it in case anyone else is interested. There's an entry in the UBO blocklist called "Fanboy's Annoyance" for .privacywire-wrapper that is causing the issue.  I had this list enabled in FF but not in chrome.

  • Like 3
Link to comment
Share on other sites

  • 1 month later...

I'm using PrivacyWire with Google Analytics. Looking at their documentation it is possible to load GA4 without cookies.
How would I go about updating the GA settings when statistics cookies get approved instead of blocking the analytics script altogether?
https://developers.google.com/tag-platform/devguides/consent

Is there a JS variable I can check for or I have to parse local storage to find the answer?
I understand that I can run a script when consent is changed, I was just wondering if there's anything already exposed.

Link to comment
Share on other sites

On 5/9/2022 at 3:36 PM, Jozsef said:

I'm using PrivacyWire with Google Analytics. Looking at their documentation it is possible to load GA4 without cookies.
How would I go about updating the GA settings when statistics cookies get approved instead of blocking the analytics script altogether?
https://developers.google.com/tag-platform/devguides/consent

Is there a JS variable I can check for or I have to parse local storage to find the answer?
I understand that I can run a script when consent is changed, I was just wondering if there's anything already exposed.

I know this is not exactly what you were asking for, and it's based on an older version of PrivacyWire so there may be an easier way to do it now, but here's how I handled a similar need (just in case it's of use to you or someone else here):

<script>
  window.cookieConsentUpdate = function(do_update) {
  do_update = typeof do_update === 'boolean' ? do_update : true;
  let privacywire_data = window.localStorage.getItem('privacywire') ? JSON.parse(window.localStorage.getItem('privacywire')) : '';
  window.cookie_consent = {
    'necessary': privacywire_data ? (Boolean(privacywire_data.necessary) ?? true) : true,
    'functional': Boolean(privacywire_data.functional) ?? false,
    'statistics': Boolean(privacywire_data.statistics) ?? false,
    'marketing': Boolean(privacywire_data.marketing) ?? false,
    'external_media': Boolean(privacywire_data.external_media) ?? false
  };
  if (do_update) {
    // this is where you could send data to GA etc.
  }
}
window.cookieConsentUpdate(false);
</script>

Now just have this function run when cookie settings are changed; do_update will default to true, and any custom code in the if block will be triggered.

  • Like 2
Link to comment
Share on other sites

  • 2 weeks later...

Is PrivacyWire GDPR compliant? (General Data Protection Regulation in the EU)

I'm in the process of implementing Google AdSense in a site. I could just leave out personalised ads altogether, which is what I do for the time being, but it's good advice to include it because of a higher ROI. 

To my understanding, if you want to include personalised ads in the EU, you need to give the user the possibility to opt-in and opt-out of personalised ads.

I found these articles in the Google AdSense docs

https://support.google.com/adsense/answer/9681920?hl=en
https://support.google.com/adsense/answer/10961068?hl=en#zippy=%2Cgdpr-messages-with-two-buttons-manage-options-consent

So it looks like Google offers to take care of the relevant privacy notifications and opt-in/opt-out buttons with a separate pop-up dialogue, but I want to have all that stuff handled in just one banner/dialogue (PrivacyWire), anything else is just too annoying for the user.

So any chance I can accomplish this with PrivacyWire? 

Link to comment
Share on other sites

  • 3 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...