Forums / All Other Contributions/Addons / cookie consent script

cookie consent script

Started by schoolboy on 30 Apr 2012, 12:36 PM · Views: 16,664

Results 41 to 60 of 84
9 Jun 2012, 6:41 PM
#41
adb34 avatar

adb34

Totally Zenned

Join Date:
Mar 2008
Location:
Brampton, Cumbria, United Kingdom, United Kingdom
Posts:
825
Plugin Contributions:
0

cookie consent script

Lol oh no :-( well once I get to my p.c later I can advise how I got the wolf script working on my site, if you would like me to? it works fine,

Yes please

Learning Fast.
Eden Craft Supplies

10 Jun 2012, 9:13 AM
#42
rizla avatar

rizla

Zen Follower

Join Date:
Sep 2010
Posts:
449
Plugin Contributions:
0

Re: cookie consent script

Hi,
Ive got the Civicuk on working EXCEPT it breaks my slider on the index page (easy slider) as part of the template.

I have done some reading up and now know these two must be conflicting. Some sites talk about using jQuery.noConflict();

Trouble is I have no idea where or how to include this. I have attempted without success. Should this be placed in the civicuk code on tpl_mainpage.php?
or elswhere?

My code below:

<script src="http://www.geoplugin.net/javascript.gp" type="text/javascript"></script> <script src="cookieControl-4.1.min.js" type="text/javascript"></script> <script type="text/javascript">//<![CDATA[ cookieControl({ introText:'<p>This site uses some unobtrusive cookies to store information on your computer.</p>', fullText:'<p>Some cookies on this site are essential, and the site won\'t work as expected without them. These cookies are set when you submit a form, login or interact with the site by doing something that goes beyond clicking on simple links.</p><p>We also use some non-essential cookies to anonymously track visitors or enhance your experience of the site. If you\'re not happy with this, we won\'t set these cookies but some nice features of the site may be unavailable.</p><p>By using our site you accept the terms of our <a href="http://www.thepersonalisedtouch.com/index.php?main_page=privacy">Privacy Policy</a>.</p>', position:'right', // left or right shape:'diamond', // triangle or diamond theme:'dark', // light or dark startOpen:true, autoHide:6000, subdomains:true, onAccept:function(){ccAddAnalytics()}, onReady:function(){}, onCookiesAllowed:function(){ccAddAnalytics()}, onCookiesNotAllowed:function(){}, countries:'United Kingdom' // Or supply a list ['United Kingdom', 'Greece'] }); function ccAddAnalytics() { jQuery.getScript("http://www.google-analytics.com/ga.js", function() { var GATracker = _gat._createTracker('UA-26988682-1'); GATracker._trackPageview(); }); } //]]> </script> </body>
10 Jun 2012, 9:22 AM
#43
torvista avatar

torvista

Totally Zenned

Join Date:
Aug 2007
Location:
Gijón, Asturias, Spain
Posts:
2,879
Plugin Contributions:
7

Re: cookie consent script

Is there any reason why not to implement this notification using the stock Zen Cart message stack mechanism?

None of the solutions touted here seem to be multiple-language-friendly.

Steve
github.com/torvista: BackupMySQL, Structured Data, Multiple Copy-Move-Delete, Google reCaptcha, Image Checker, Spanish Language Pack and more...

10 Jun 2012, 12:27 PM
#44
picandnix avatar

picandnix

Totally Zenned

Join Date:
Dec 2010
Location:
UK
Posts:
1,779
Plugin Contributions:
2

Re: cookie consent script

adb34:

Yes please

Hi adb34
my apologies for the delay (kids, enough said...lol)

This is just for the wolf script as first suggested to us all by Schoolboy (thank you again Schoolboy)

So, as we all know, add the lib folder and its contents to your site root then go to INCLUDES_TEMPLATES_YOUR TEMPLATE_COMMON_HTML_HEADER.PHP

as discussed those of us with sliders on our index page have had a few issues, so try this, it works just fine for me...
below is the last half of my html_header.php file for your ease as I personally often get lost when people are vague on where to write code into an existing file.

<?php if (defined('FAVICON')) { ?>
<link rel="icon" href="<?php echo FAVICON; ?>" type="image/x-icon" />
<link rel="shortcut icon" href="<?php echo FAVICON; ?>" type="image/x-icon" />
<?php } //endif FAVICON ?>

<base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER . DIR_WS_HTTPS_CATALOG : HTTP_SERVER . DIR_WS_CATALOG ); ?>" />
<?php if (isset($canonicalLink) && $canonicalLink != '') { ?>
<link rel="canonical" href="<?php echo $canonicalLink; ?>" />
<?php } ?>
<?php if($_GET['main_page']=='index' and !$_GET['products_id']){
?>
<script src="js/jquery-1.4.4.min.js" type="text/javascript" charset="utf-8"></script>
<script src="js/jquery.tools.min.js" type="text/javascript" charset="utf-8"></script>
<link href="./lib/jconsent/jconsent-default.css" rel="stylesheet" type="text/css" />
	<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
	<script src="./lib/jconsent/jconsent-1.0.3.js"></script>
		<script type="text/javascript">
		$(document).ready( function () {
				$.ws.jconsent({ noConsentCallback: function () {someoneClickedNo();} });
			});
		function someoneClickedNo() {
			alert('Without an essential session ID, you may have problems shopping on our site. Proceed with your visit, and if you have difficulties, please contact us.');
		};

		$(document).ready( function () {
			$.ws.jconsent({
				displaySettingsSelector: '.displayCookieSettings',
				geolocate: true
			});
		});
	</script>
<?php
}
?>
<?php
/**
* load the loader files
*/

if($RI_CJLoader->get('status') && (!isset($Ajax) || !$Ajax->status())){
	$RI_CJLoader->autoloadLoaders();
	$RI_CJLoader->loadCssJsFiles();
	$files = $RI_CJLoader->header();
	foreach($files['css'] as $file)
		if($file['include']) include($file['src']);
		else if(!$RI_CJLoader->get('minify') || $file['external']) echo "<link rel=\"stylesheet\" type=\"text/css\" href='{$file['src']}' />\n";
		else echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"min/?f={$file['src']}&".$RI_CJLoader->get('minify_time')."\" />\n";

	foreach($files['jscript'] as $file)
		if($file['include']) include($file['src']);
		else if(!$RI_CJLoader->get('minify') || $file['external']) echo "<script type='text/javascript' src='{$file['src']}'></script>\n";
		else echo "<script type=\"text/javascript\" src=\"min/?f={$file['src']}&".$RI_CJLoader->get('minify_time')."\"></script>\n";
}
//DEBUG: echo '<!-- I SEE cat: ' . $current_category_id . ' || vs cpath: ' . $cPath . ' || page: ' . $current_page . ' || template: ' . $current_template . ' || main = ' . ($this_is_home_page ? 'YES' : 'NO') . ' -->';
?>
<!--[if IE 6]><link rel="stylesheet" type="text/css" media="screen" href="includes/templates/MY_TEMPLATE/css/ie6.css" /><![endif]-->
<!--[if IE 7]><link rel="stylesheet" type="text/css" media="screen" href="includes/templates/MY_TEMPLATE/css/ie7.css" /><![endif]-->
</head>
<?php // NOTE: Blank line following is intended: ?>

DO NOT SIMPLY COPY AND PASTE THE ABOVE CODING, USE IT TO COMPARE IT TO YOUR HTML_HEADER.PHP FILE to see where to load the wolf script. Why? Because I have other mods in this file, inparticular CJ Loader that runs FEC javascript and as mentioned I also have a slider on my index page.

Note that I have changed the version to 1.0.3 (<script src="/lib/jconsent/jconsent-1.0.3.js"></script>) rather than 1.0.1

and thats it!
Good luck and please report back if it works just as much as I'm sure you would if it doesn't work.

10 Jun 2012, 12:56 PM
#45
picandnix avatar

picandnix

Totally Zenned

Join Date:
Dec 2010
Location:
UK
Posts:
1,779
Plugin Contributions:
2

Re: cookie consent script

OK, just thought I'd try this, but it works...I have got both (civicuk & wolf) script solutions working and happily playing together on my local install of my site by doing exactly as described within this thread.

Attachment 10601

:smartalec:

10 Jun 2012, 3:06 PM
#46
rizla avatar

rizla

Zen Follower

Join Date:
Sep 2010
Posts:
449
Plugin Contributions:
0

Re: cookie consent script

Mybe I have missed/overlooked it, but how did you avoid the slider conflict with civicuk?

OR which one is the easier to implement? maybe the 'Wolf' looks the least invasive to our guinea pig's (great how we UK's have to test al this out, as if things 'aint bad enough)

10 Jun 2012, 4:08 PM
#47
picandnix avatar

picandnix

Totally Zenned

Join Date:
Dec 2010
Location:
UK
Posts:
1,779
Plugin Contributions:
2

Re: cookie consent script

Rizla:

Mybe I have missed/overlooked it, but how did you avoid the slider conflict with civicuk?

OR which one is the easier to implement? maybe the 'Wolf' looks the least invasive to our guinea pig's (great how we UK's have to test al this out, as if things 'aint bad enough)

I put it down to luck rather than any skill that I have got them both working in tandum.
As for which one I agree, I think wolf script is less invasive, not that civicuk is actually invasive but once the shopper has clicked 'yes' then there its no more reminders that one used cookies therefore leaving them to get on with their browsing.

10 Jun 2012, 6:02 PM
#48
rizla avatar

rizla

Zen Follower

Join Date:
Sep 2010
Posts:
449
Plugin Contributions:
0

Re: cookie consent script

Picandnix
Thanks for the reply.... I would prefer to get the civicuk working.... Almost considering ridding the slider all together (not by choice)
Presuming 'someone' may have an answer to solving the slider conflict.... Have you got either set up for 'ALL' Euro' countries or just 'English' I presume it need to al EU?

Oh! Why can't one of our GREAT geeks write a mod ;)))

10 Jun 2012, 6:52 PM
#49
asekeris avatar

asekeris

New Zenner

Join Date:
Mar 2006
Location:
Zevenbergen, NL
Posts:
40
Plugin Contributions:
0

Re: cookie consent script

I have the civicuk working in multiple languages and as far as i can see nothing interfeers.
In the end it is a quick and dirty method but it works.

How i did it:

  1. Generated and downloaded the script and code snippet from civicuk.
  2. Created a sub-folder under the root of the site.
  3. Placed de jquery.min.js from google there with the downloaded scipt from civicuk.
  4. Created two sub-folders for my extra languages (de and nl) and placed the scripts there also.
    My tree is now:
    /
    --/cookie_script
    ----jquery.min.js
    ----cookieControl-4.1.min.js
    ----/de
    ------cookieControl-4.1.min.js
    ----/nl
    ------cookieControl-4.1.min.js
    Modified all tree instances of the script cookieControl-4.1.min.js takes its jquerie from the server instead of google.
    (my site is in full ssl and the certificate was broken without this modification)
    Translated the two scripts in the de and nl subfolders.
  5. Modified the tpl_main_page.php in my_template_folder.
    (It would be better to also modify the file in de default folder for if you ever start a new template)
    Just before the final /body added the following code:
 
<!--bof cookie control -->
<?php
	if ($_SESSION['language']=='dutch') {
?>
<script src="https://www.geoplugin.net/javascript.gp" type="text/javascript"></script>
<script src="/cookie_script/nl/cookieControl-4.1.min.js" type="text/javascript"></script>
<script type="text/javascript">//<![CDATA[
  cookieControl({
      introText:'<p>Your dutch short text.</p>',
      fullText:'<p>Your dutch long text.</p>',
      position:'right', // left or right
      shape:'triangle', // triangle or diamond
      theme:'dark', // light or dark
      startOpen:true,
      autoHide:10000,
      subdomains:true,
      onAccept:function(){ccAddAnalytics()},
      onReady:function(){},
      onCookiesAllowed:function(){ccAddAnalytics()},
      onCookiesNotAllowed:function(){},
      countries:'Europe, Anonymous Proxy'//'Europe, Anonymous Proxy' // Or supply a list ['United Kingdom', 'Greece']
      });

      function ccAddAnalytics() {
        jQuery.getScript("https://www.google-analytics.com/ga.js", function() {
          var GATracker = _gat._createTracker('');
          GATracker._trackPageview();
        });
      }
   //]]>
</script>  
<?php
	} elseif ($_SESSION['language']=='german') {
?>
<script src="https://www.geoplugin.net/javascript.gp" type="text/javascript"></script>
<script src="/cookie_script/de/cookieControl-4.1.min.js" type="text/javascript"></script>
<script type="text/javascript">//<![CDATA[
  cookieControl({
      introText:'<p>Your german short text.</p>',
      fullText:'<p>Your german long text.</p>',
      position:'right', // left or right
      shape:'triangle', // triangle or diamond
      theme:'dark', // light or dark
      startOpen:true,
      autoHide:10000,
      subdomains:true,
      onAccept:function(){ccAddAnalytics()},
      onReady:function(){},
      onCookiesAllowed:function(){ccAddAnalytics()},
      onCookiesNotAllowed:function(){},
      countries:'Europe, Anonymous Proxy' // Or supply a list ['United Kingdom', 'Greece']
      });

      function ccAddAnalytics() {
        jQuery.getScript("https://www.google-analytics.com/ga.js", function() {
          var GATracker = _gat._createTracker('');
          GATracker._trackPageview();
        });
      }
   //]]>
</script>  
<?php } else { ?>
<script src="https://www.geoplugin.net/javascript.gp" type="text/javascript"></script>
<script src="/cookie_script/cookieControl-4.1.min.js" type="text/javascript"></script>
<script type="text/javascript">//<![CDATA[
  cookieControl({
      introText:'<p>This site uses some unobtrusive cookies to store information on your computer.</p>',
      fullText:'<p>Some cookies on this site are essential, and the site won\'t work as expected without them. These cookies are set when you submit a form, login or interact with the site by doing something that goes beyond clicking on simple links.</p><p>We also use some non-essential cookies to anonymously track visitors or enhance your experience of the site. If you\'re not happy with this, we won\'t set these cookies but some nice features of the site may be unavailable.</p><p>By using our site you accept the terms of our <a href="https://YOUR_SITE/privacy">Privacy Policy</a>.</p>',
      position:'right', // left or right
      shape:'triangle', // triangle or diamond
      theme:'dark', // light or dark
      startOpen:true,
      autoHide:10000,
      subdomains:true,
      onAccept:function(){ccAddAnalytics()},
      onReady:function(){},
      onCookiesAllowed:function(){ccAddAnalytics()},
      onCookiesNotAllowed:function(){},
      countries:'Europe, Anonymous Proxy' // Or supply a list ['United Kingdom', 'Greece']
      });

      function ccAddAnalytics() {
        jQuery.getScript("https://www.google-analytics.com/ga.js", function() {
          var GATracker = _gat._createTracker('');
          GATracker._trackPageview();
        });
      }
   //]]>
</script>  
<?php } ?>
<!--eof cookie control -->
  1. Thats all.

This can work for any language and if you did not define the language in the tpl_man_page.php it will show the message in english.
Notis that all extarnal scripts are adressed in https and if you do not use full SSL change them back to http.

For me it works and i hope it is usefull for someone else.
(You can see it work on https://www.onderdelenmetshop.nl)

10 Jun 2012, 9:39 PM
#50
picandnix avatar

picandnix

Totally Zenned

Join Date:
Dec 2010
Location:
UK
Posts:
1,779
Plugin Contributions:
2

Re: cookie consent script

Rizla:

Picandnix
Thanks for the reply.... I would prefer to get the civicuk working.... Almost considering ridding the slider all together (not by choice)
Presuming 'someone' may have an answer to solving the slider conflict.... Have you got either set up for 'ALL' Euro' countries or just 'English' I presume it need to al EU?

Oh! Why can't one of our GREAT geeks write a mod ;)))

Hi Rizla
hopefully askeris' post above will aid you in getting multi language setup, I personally am just sticking with English.
If you wish PM me the content of your tpl_main_page.php file and I will compare it to mine and see if I can shed any light.

13 Jun 2012, 2:52 PM
#51
pudzpud avatar

pudzpud

Zen Follower

Join Date:
May 2009
Posts:
156
Plugin Contributions:
0

Re: cookie consent script

schoolboy:

The tpl_main_page.php MUST sit inside the COMMON folder(s) of the templates you have installed. If you have tpl_main_page.php in other directories, delete these instances.

Your asterisk shows you have edited the incorrect file. The one that needs editing sits inside the COMMON folder of your custom template.

Hi, I will try adding the code to the common/tpl_main_page.php file instead.
Also I am wary of deleting the other files as I paid someone else to upgrade the website and I don't know if they left them there for a reason i.e. if I delete the others then something else they did may not work :(

13 Jun 2012, 3:46 PM
#52
picandnix avatar

picandnix

Totally Zenned

Join Date:
Dec 2010
Location:
UK
Posts:
1,779
Plugin Contributions:
2

Re: cookie consent script

PudzPud:

Hi, I will try adding the code to the common/tpl_main_page.php file instead.
Also I am wary of deleting the other files as I paid someone else to upgrade the website and I don't know if they left them there for a reason i.e. if I delete the others then something else they did may not work :(

Create a backup first.

13 Jun 2012, 4:01 PM
#53
pudzpud avatar

pudzpud

Zen Follower

Join Date:
May 2009
Posts:
156
Plugin Contributions:
0

Re: cookie consent script

Thank you all so much the civicuk one now works perfectly on my 1.3.9 version :)

13 Jun 2012, 4:14 PM
#54
picandnix avatar

picandnix

Totally Zenned

Join Date:
Dec 2010
Location:
UK
Posts:
1,779
Plugin Contributions:
2

Re: cookie consent script

PudzPud:

Thank you all so much the civicuk one now works perfectly on my 1.3.9 version :)

Well done, you will be the envy of many now :cool:

13 Jun 2012, 7:30 PM
#55
rizla avatar

rizla

Zen Follower

Join Date:
Sep 2010
Posts:
449
Plugin Contributions:
0

Re: cookie consent script

picandnix..... SHUT UP ;))))

Was up at 2am on the las communication and 2.30 the morning after LOL

Bet he 'aint got a slider?

Getting there and thanks for the help BTW

13 Jun 2012, 10:01 PM
#56
picandnix avatar

picandnix

Totally Zenned

Join Date:
Dec 2010
Location:
UK
Posts:
1,779
Plugin Contributions:
2

Re: cookie consent script

Rizla:

picandnix..... SHUT UP ;))))

Was up at 2am on the las communication and 2.30 the morning after LOL

Bet he 'aint got a slider?

Getting there and thanks for the help BTW

Lol. Are you any further forward yet? Its a proper pain isn't it.

13 Jun 2012, 11:26 PM
#57
discoverytdi avatar

discoverytdi

Totally Zenned

Join Date:
May 2011
Location:
Sunny Rossendale (not)
Posts:
562
Plugin Contributions:
0

Re: cookie consent script

Sounds to me like it's more trouble than it's worth wouldn't a sidebox with a link to your privacy page do, save all the aggro

What ever your doing remember to KISS ( Keep It Simple Stupid )

14 Jun 2012, 11:43 AM
#58
spid3r1987 avatar

spid3r1987

Zen Follower

Join Date:
Jul 2009
Posts:
497
Plugin Contributions:
0

Re: cookie consent script

the civicuk one is really easy tbh
choose locations and icons etc
copy the script provided, place in /includes/templates/(your temp)/common/tpl_main_page.php
place the script code at the very bottom, JUST BEFORE the closing </body>
then look at the script for the line saying <script src="/PATH_TO_COOKIE_CONTROL/cookieControl-5.0.min.js" type="text/javascript"></script>
And change it to say

<script src="./lib/cookieControl-5.0.min.js" type="text/javascript"></script>

save and upload
click the link on the civicuk page for the JS file
file save as...w/e its called
upload the file to a folder in your ROOT directory called lib

all should be working fine

i may not know how yet, but i soon will....i hope :)

14 Jun 2012, 12:34 PM
#59
rizla avatar

rizla

Zen Follower

Join Date:
Sep 2010
Posts:
449
Plugin Contributions:
0

Re: cookie consent script

picandnix...

No closer.... defo a conflict with EasySlider loading first and as they are on seperate calls (define_main_page.php for the slider) and (tpl_main_page.php) I can't see any easy way around it.... Not as if I could call the jscrip's from one page (in order)

Trying all the suggestions from general Java forums but nothing works as yet.

So far I have edidted the EasySlider call to the following.... (not working and about to call it a day)

<script>jQuery.noConflict(true);</script>
<script type="text/javascript" src="includes/templates/andover_modern/jscript/jscript_iquery.js"></script>
   	<script type="text/javascript">
	

	jQuery(document).ready(function(){	

		jQuery("#slider").easySlider({

			auto: true, 

			continuous: true,

			numeric: true

		});

	});	

</script>
14 Jun 2012, 12:49 PM
#60
picandnix avatar

picandnix

Totally Zenned

Join Date:
Dec 2010
Location:
UK
Posts:
1,779
Plugin Contributions:
2

Re: cookie consent script

Rizla:

picandnix...

No closer.... defo a conflict with EasySlider loading first and as they are on seperate calls (define_main_page.php for the slider) and (tpl_main_page.php) I can't see any easy way around it.... Not as if I could call the jscrip's from one page (in order)

Trying all the suggestions from general Java forums but nothing works as yet.

So far I have edidted the EasySlider call to the following.... (not working and about to call it a day)

<script>jQuery.noConflict(true);</script> <script type="text/javascript" src="includes/templates/andover_modern/jscript/jscript_iquery.js"></script>
   	<script type="text/javascript">
  

  jQuery(document).ready(function(){	

  	jQuery("#slider").easySlider({

  		auto: true, 

  		continuous: true,

  		numeric: true

  	});

  });	
</script>

Might be worth asking Anne in her template thread http://www.picaflor-azul.com/support/viewforum.php?f=7