Title: [Plugin: Cookie Control] JavaScript
Last modified: August 20, 2016

---

# [Plugin: Cookie Control] JavaScript

 *  [qui_gon_jim](https://wordpress.org/support/users/qui_gon_jim/)
 * (@qui_gon_jim)
 * [13 years, 10 months ago](https://wordpress.org/support/topic/plugin-cookie-control-javascript/)
 * If you accept cookies, then look at the browser cookies that are set, there does
   not seem to be any analytics cookies being set. It is setting the ‘civicAllowCookies’
   to true, but does not seem to be executing the analytics ccAddAnalytics function,
   and I have checked this is one of the functions to be run on accept.
 * I have had a look at the plugin code, and the JavaScript set in the plugin is
   different to the JavaScript that is supplied for a manual installation. I changed
   the plugin JavaScript so that it is the same, and the analytics cookies started
   to be set again.
 * This could be down to my specific WordPress configuration, however thought I 
   would let you know so that you could check.
 * [http://wordpress.org/extend/plugins/cookie-control/](http://wordpress.org/extend/plugins/cookie-control/)

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Thread Starter [qui_gon_jim](https://wordpress.org/support/users/qui_gon_jim/)
 * (@qui_gon_jim)
 * [13 years, 10 months ago](https://wordpress.org/support/topic/plugin-cookie-control-javascript/#post-2905374)
 * It is currently:
 * <script type=”text/javascript”>
    jQuery(document).ready(function() { cookieControl({
   introText:”<p><?php echo sanitize_text_field($cookiecontrol_settings[‘introText’]);?
   > ‘>Privacy Policy.</p>”, fullText:”<p><?php echo sanitize_text_field($cookiecontrol_settings[‘
   fullText’]); ?></p>”, position:'<?php echo $cookiecontrol_settings[‘position’];?
   >’, shape:'<?php echo $cookiecontrol_settings[‘shape’]; ?>’, theme:'<?php echo
   $cookiecontrol_settings[‘theme’]; ?>’, startOpen:<?php echo $cookiecontrol_startopen;?
   >, autoHide:<?php echo $cookiecontrol_timeout; ?>, subdomains:'<?php echo $cookiecontrol_settings[‘
   subdomains’]; ?>’, consentModel:'<?php echo $cookiecontrol_settings[‘consentmodel’];?
   >’, onAccept:function(){<?php echo $cookiecontrol_settings[‘onaccept’]; ?>}, 
   onReady:function(){<?php echo $cookiecontrol_settings[‘onready’]; ?>}, onCookiesAllowed:
   function(){<?php echo $cookiecontrol_settings[‘cookiesallowed’]; ?>}, onCookiesNotAllowed:
   function(){<?php echo $cookiecontrol_settings[‘cookiesnotallowed’]; ?>}, countries:'
   <?php echo $cookiecontrol_settings[‘countries’]; ?>’ }); });
 * function ccAddAnalytics(){
    var _gaq = _gaq || []; _gaq.push([‘_setAccount’, ‘
   <?php echo $cookiecontrol_settings[‘gakey’]; ?>’]); _gaq.push([‘_trackPageview’]);
 *  (function() {
    var ga = document.createElement(‘script’); ga.type = ‘text/javascript’;
   ga.async = true; ga.src = (‘https:’ == document.location.protocol ? ‘[https://ssl&#8217](https://ssl&#8217);:‘
   [http://www&#8217](http://www&#8217);) + ‘.google-analytics.com/ga.js’; var s
   = document.getElementsByTagName(‘script’)[0]; s.parentNode.insertBefore(ga, s);})();};
   </script>
 *  Thread Starter [qui_gon_jim](https://wordpress.org/support/users/qui_gon_jim/)
 * (@qui_gon_jim)
 * [13 years, 10 months ago](https://wordpress.org/support/topic/plugin-cookie-control-javascript/#post-2905375)
 * _[ Moderator Note: Please post code or markup snippets between backticks or use
   the code button. ]_
 * Modified to this which is inline with manual code:
 *     ```
       <script type="text/javascript">
       	//<![CDATA[
       	cookieControl({
       		introText:"<p><?php echo sanitize_text_field($cookiecontrol_settings['introText']); ?> <a>'>Privacy Policy.</a></p>",
       		fullText:"<p><?php echo sanitize_text_field($cookiecontrol_settings['fullText']); ?></p>",
       		position:'<?php echo $cookiecontrol_settings['position']; ?>',
       		shape:'<?php echo $cookiecontrol_settings['shape']; ?>',
       		theme:'<?php echo $cookiecontrol_settings['theme']; ?>',
       		startOpen:<?php echo $cookiecontrol_startopen; ?>,
       		autoHide:<?php echo $cookiecontrol_timeout; ?>,
       		subdomains:'<?php echo $cookiecontrol_settings['subdomains']; ?>',
       		consentModel:'<?php echo $cookiecontrol_settings['consentmodel']; ?>',
       		onAccept:function(){<?php echo $cookiecontrol_settings['onaccept']; ?>},
       		onReady:function(){<?php echo $cookiecontrol_settings['onready']; ?>},
       		onCookiesAllowed:function(){<?php echo $cookiecontrol_settings['cookiesallowed']; ?>},
       		onCookiesNotAllowed:function(){<?php echo $cookiecontrol_settings['cookiesnotallowed']; ?>},
       		countries:'<?php echo $cookiecontrol_settings['countries']; ?>'
       	});
       	function ccAddAnalytics() {
       		jQuery.getScript("http://www.google-analytics.com/ga.js", function() {
       			var GATracker = _gat._createTracker('UA-717581-15');
       			GATracker._trackPageview();
       		});
       	}
       	//]]>
       </script>
       ```
   
 *  Thread Starter [qui_gon_jim](https://wordpress.org/support/users/qui_gon_jim/)
 * (@qui_gon_jim)
 * [13 years, 10 months ago](https://wordpress.org/support/topic/plugin-cookie-control-javascript/#post-2905502)
 * Sorry, the code I changed it to was this, the code above had my analytics ID 
   hard coded!
 *     ```
       <script type="text/javascript">
       	//<![CDATA[
       	cookieControl({
       		introText:"<p><?php echo sanitize_text_field($cookiecontrol_settings['introText']); ?> <a href='<?php echo $privacy; ?>'>Privacy Policy.</a></p>",
       		fullText:"<p><?php echo sanitize_text_field($cookiecontrol_settings['fullText']); ?></p>",
       		position:'<?php echo $cookiecontrol_settings['position']; ?>',
       		shape:'<?php echo $cookiecontrol_settings['shape']; ?>',
       		theme:'<?php echo $cookiecontrol_settings['theme']; ?>',
       		startOpen:<?php echo $cookiecontrol_startopen; ?>,
       		autoHide:<?php echo $cookiecontrol_timeout; ?>,
       		subdomains:'<?php echo $cookiecontrol_settings['subdomains']; ?>',
       		consentModel:'<?php echo $cookiecontrol_settings['consentmodel']; ?>',
       		onAccept:function(){<?php echo $cookiecontrol_settings['onaccept']; ?>},
       		onReady:function(){<?php echo $cookiecontrol_settings['onready']; ?>},
       		onCookiesAllowed:function(){<?php echo $cookiecontrol_settings['cookiesallowed']; ?>},
       		onCookiesNotAllowed:function(){<?php echo $cookiecontrol_settings['cookiesnotallowed']; ?>},
       		countries:'<?php echo $cookiecontrol_settings['countries']; ?>'
       	});
       	function ccAddAnalytics() {
       		jQuery.getScript("http://www.google-analytics.com/ga.js", function() {
       			var GATracker = _gat._createTracker('<?php echo $cookiecontrol_settings['gakey']; ?>');
       			GATracker._trackPageview();
       		});
       	}
       	//]]>
       </script>
       ```
   

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘[Plugin: Cookie Control] JavaScript’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/cookie-control_ceeddc.svg)
 * [Cookie Control](https://wordpress.org/plugins/cookie-control/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/cookie-control/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/cookie-control/)
 * [Active Topics](https://wordpress.org/support/plugin/cookie-control/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/cookie-control/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/cookie-control/reviews/)

 * 3 replies
 * 1 participant
 * Last reply from: [qui_gon_jim](https://wordpress.org/support/users/qui_gon_jim/)
 * Last activity: [13 years, 10 months ago](https://wordpress.org/support/topic/plugin-cookie-control-javascript/#post-2905502)
 * Status: not resolved