So I was asked a couple days ago to install a cookie plugin on client side and what I did. I was asked what the plug-in is doing exactly and that’s. A million dollar question, because the plug-in by default isn’t doing anything.
It’s, saying something like if you’re using the site, we’re gonna be collecting your cookies. If you’re, ok with that click, OK, and so they would click ok, but the thing is is if they’re like no, it’s, not ok! I don’t want you to to put cookies in my browser, then they can’t do anything about it.
So what’s? The point it’s better, I guess just to say we’re taking your cookies and that’s. That’s. The bottom line, if you don’t like it, get out of here, better to say that, but instead we’re, giving them a chance to accept it, but not deny it.
So it’s kind of weird in these plugins. When you install these plugins, they would be the install instructions will say something like just in simply install the plug-in and activate they’re good to go, but you’re.
Really not so anyway, I want to look at that today. I want to look at exactly what these plugins are supposed to be doing, and I’m gonna be using a very popular one to demonstrate called cookie notice by defect 3.
That’s, seven hundred thousand plus installs active installs and 301 reviews five stars. So I’m gonna show you how this works and if you have a cookie plug-in that you’re, not quite sure what it’s. Doing then watch this video.
Let me show you how you can actually block scripts from loading until they accept that cookie. They accept your notice and that’s. The intent of it I’m, not sure if that’s, the best practice, or if that’s, something you want to do.
I’m still. Processing this whole thing. How I want to do it so make sure you do leave a comment in always, as always subscribe to the channel lots of great videos coming and if you have any requests of videos that you want done.
Just email me at contact at Travis dot, media and I will make them getting it for you alright. So let me show you: let’s, jump on here and install that plug-in. So I have a test site here and I’m. Just gonna go what’s a dashboard, and I’m gonna go to my plugins and I’m gonna click.
Add new, and I’m gonna make myself smaller here and I’m gonna go over here and type in cookie notice. Now there’s, two cookie notice, plugins! You want the one by the factory this one here, I’m gonna click install now and activate it according to a lot of cookie plugins.
I’m good to go, but I’m. Really not let’s. Take a look at this. I’m gonna go to settings there settings here and there’s, also settings over here or cookie notice. Now let now real quick. If you’re using Chrome, you can see what cookies are being sent.
So let’s, go to settings and down at the bottom, you’ll, see a button for it advanced and then you’ll, see content, settings and cookies and see all cookies and site data click that and type in Your site, mine, is test site down to local, so I’m gonna click test site and you see I have five cookies set.
These are basic WordPress cookies that WordPress uses so no problem here. So that’s. How you see what and I’m gonna show you something in the screen in a minute, but let’s, go back and look at the plugin, alright.
So what’s? The point of clicking? Okay? If you know we’re taking your cookies up here, it says we’re taking their cookies, and if you continue this side, we assume you’re happy with it click! Ok, to be okay with that.
You want to link to that. Okay, that’s, something that is important, so read more page link. I don’t, have a price upon Z, because I just whipped up this test side. So I’m. Just going to sample page and down.
Accepting that looks for the cookie. That is set when you accept the cookies, when you accept, when you click, OK or accept it’s. Going to this function is gonna, say that and then it’s going to allow the script to run.
Now, if you some some websites or blocking things like Google, Analytics or crazy egg or lucky orange or a Google tag manager, something like that, they’re. They’re gonna block those until cookies are accepted.
So if you come on the site and you you’re, like I’m gonna click, refuse, if you get that option, because you don’t want to be tracked, then you can set your script here so where Normally you would, you would go into your next alone, where normally you would go into your header or a lot of themes offer this easily done with some kind of customizer or some kind of easier feature.
Where you go into your header in place, you save your Google Analytics code. So let me just show you this. If I put Google Analytics in the header and I open the site – and I do the page source – you’re gonna see that I have Google Analytics script here in my header now what this plugin does, instead of just putting that in your Header or putting it in the customizer or, however, you do with your screen.
You would put it here instead, and this would be conditional on them accepting your cookies. So let me remove that. Remove that and be sure it’s, not in the page. There it is it’s gone all right, so I’m gonna put that script, that Google Analytics script into this script blocking and also, if you think about it, if they click OK in menu, and then you allow scripts.
You also want to reload the page, so the script can load okay, so you want to click this box and able to reload the page after cookies are accepted. So let’s, flick that and let’s, give it a shot and we ‘
Ll, come back to the rest of the settings in a minute, so Save Changes. Alright, so I entered my Google Analytics script. I’m gonna go back to my site and I’m gonna refresh and my script is not there.
So I’m gon. Na click accept the minute, you click that this function runs and it checks for a specific cookie. Let me show you what that cookie is back to settings, go back here and just kind of refresh that I have nine cookies now and that’s.
My Google Analytics cookies, but the main one here we want to look at is cookie notice accepted when you accept the cookies, with the cookie notice plug in it inserts our cookie in your browser, called cookie notice, accepted once the function sees that it now allows your Scripts, so if I now go to the source and refresh, I should see that that script is now on my page and it is not so something’s up, Oh actually, yeah.
Actually it might be yeah here. It is right here. Sorry I don’t know why I thought it’d, be in the same spot. It’s. Gon na put it down lower because it’s. It’s, dependent on the cookie notice, wherever they want to hook it into so we’ll, probably WP hit, but anyway.
So here’s, my script, my script is now there so that’s. That’s, the basic gist of it. If you, your, Google, Analytics crazy egg, lucky orange Google tag manager all of these scripts that you would put into the header normally, if you want to have those not run until the cookies are, except, if you put that here in the head, if you have body Script, you can put that into the body script and then, when they click, OK, it’s going to reload the page after the cookies are accepted.
Now let me show you one other thing: if I go over here back to my cookies and I erase these okay, I don’t want cookie notice, except that I want to clear all of these cookies out and I signed out of my sight.
I go to logout and I close these other pages. Yes, I want to logout all right and let me open up a page and just kind of click around a little bit. Let me visit my hello world post and now. Let me go back to my cookies and you punch this in one test site.
You see that I have five cookies again, so by default, this cookie plugin is not doing anything. It’s, just saying, as we discuss a lot going through again, but anyway it’s, not doing anything. If you really want to give the option, then you want to block the scripts until they accept the cookies.
And again, I’m, not sure if that’s, the best practice, because I don’t like that idea either, but that is what the plugin is for. So in that case you would do something like this. I can go back to my settings and I can choose this all right, unable to give the user the possibility to refuse third party non-functional cookies, so I can give them the option to say no.
So if I’m, saying hey, I’m going to collect your stuff. Is that okay click OK seems like. I should give them the option to say no, that’s, not okay, just my thoughts. So if I check this, it’s. Gon na put another button in the ribbon, and so instead of no, I’m gonna put define like Save Changes, and then let me go back to my cookies here and just delete them all right.
So if I go back to my site now, I should have the banner again giving both options all right here’s, the notice I can accept, or I can decline if I click the climb, that notice is gone and let’s. See if my script is running so previously, if i refresh this enough, but anyway let’s, hit refresh and see.
If my script is in there, let’s, search for Google, my parents out there and stop them. So Google Analytics was somewhere around here and it is not there. So that’s, the that’s, the other option. You know I don’t again, I don’t know if you want people to to decline your cookies, but that’s, an option.
Okay. So if we jump back just one more thing, I don’t mean to keep you out. Let me log back in alright, so so I have, I mean they’re able to refuse they’re able to excel. Let’s. Look at a couple. Other things that are offered here here is the option to accept cookies on scroll, and I’m, not sure if this is the best practice either, but what it is is if they see your notice and they’re like oh, whatever.
I’m gonna check this out anyway and start scrolling, then that automatically accepts and kind of mean, but not sure. If that’s best practice cookie expiry. You can change this. When you want your cookie to expire, you can change it to whatever it’s by default, set in one month.
Script: placement: do you want it in the header or footer the design we have at the bottom? We have it as a fade animation. We have bootstrap button style and that’s, it so basically what what you’re doing.
Is you’re, giving them the option to to browse your site without being without certain scripts running if they don & # 39? T accept the cookies, then these certain things will happen. These cookies won’t be set, so these scripts can’t run that’s, basically it so if you use cookie notice and you like it by default, leave it by default that’s.