Title: prototypead's Replies | WordPress.org

---

# prototypead

  [  ](https://wordpress.org/support/users/prototypead/)

 *   [Profile](https://wordpress.org/support/users/prototypead/)
 *   [Topics Started](https://wordpress.org/support/users/prototypead/topics/)
 *   [Replies Created](https://wordpress.org/support/users/prototypead/replies/)
 *   [Reviews Written](https://wordpress.org/support/users/prototypead/reviews/)
 *   [Topics Replied To](https://wordpress.org/support/users/prototypead/replied-to/)
 *   [Engagements](https://wordpress.org/support/users/prototypead/engagements/)
 *   [Favorites](https://wordpress.org/support/users/prototypead/favorites/)

 Search replies:

## Forum Replies Created

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

 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Total Sales Counts for WooCommerce] item of number sold at product page show two times](https://wordpress.org/support/topic/item-of-number-sold-at-product-page-show-two-times/)
 *  [prototypead](https://wordpress.org/support/users/prototypead/)
 * (@prototypead)
 * [7 years, 4 months ago](https://wordpress.org/support/topic/item-of-number-sold-at-product-page-show-two-times/#post-11052234)
 * I would also like an update on this my single product is also showing products
   sold twice.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[GDPR] Cookie block helper function added warning message to WP Dashboard](https://wordpress.org/support/topic/cookie-block-helper-function-added-warning-message-to-wp-dashboard/)
 *  Thread Starter [prototypead](https://wordpress.org/support/users/prototypead/)
 * (@prototypead)
 * [8 years ago](https://wordpress.org/support/topic/cookie-block-helper-function-added-warning-message-to-wp-dashboard/#post-10296790)
 * Look forward to the update. Thank you for all your hard work!
 * I do have a question regarding php code. I am trying to understand what is the
   difference between these two codes?
 * 1.
    `if ( is_allowed_cookie( '_ga' ) ) {` and 2. `if ( ! has_consent( 'privacy-
   policy' ) || ! is_allowed_cookie( '_ga' ) ) {`
 * Thanks
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[GDPR] Cookie block helper function added warning message to WP Dashboard](https://wordpress.org/support/topic/cookie-block-helper-function-added-warning-message-to-wp-dashboard/)
 *  Thread Starter [prototypead](https://wordpress.org/support/users/prototypead/)
 * (@prototypead)
 * [8 years ago](https://wordpress.org/support/topic/cookie-block-helper-function-added-warning-message-to-wp-dashboard/#post-10293457)
 * Ok, I figured it out – had placed a closing php tag.
 * Though, I am confused how all this works. When I test on the site using the code
   above on initial website load (browser cookies are cleared) the ga cookie doesn’t
   seem to be “on”. Then I agree to terms and the ga cookies is still not on. Only
   when I go to preferences and “turn on” the cookie, it shows up.
 * What I want to accomplish is when user agrees to Privacy Policy (the language
   in the privacy policy does state if they agree to terms the cookie will be enabled),
   the ga cookie turns “on”. Then, if they want to turn it off, then they have to
   go to privacy policy and turn it off.
 * How do I achieve that, what code to use?
 * Thank you.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[GDPR] Cookie block helper function added warning message](https://wordpress.org/support/topic/cookie-block-helper-function-added-warning-message/)
 *  Thread Starter [prototypead](https://wordpress.org/support/users/prototypead/)
 * (@prototypead)
 * [8 years ago](https://wordpress.org/support/topic/cookie-block-helper-function-added-warning-message/#post-10293394)
 * Please ignore this message, it is a duplicate of another!
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[GDPR] Email field does not show up in request form in Chrome](https://wordpress.org/support/topic/email-field-does-not-show-up-in-request-form-in-chrome/)
 *  Thread Starter [prototypead](https://wordpress.org/support/users/prototypead/)
 * (@prototypead)
 * [8 years ago](https://wordpress.org/support/topic/email-field-does-not-show-up-in-request-form-in-chrome/#post-10292987)
 * Thank you, makes sense.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[GDPR] Cookie block](https://wordpress.org/support/topic/cookie-block/)
 *  [prototypead](https://wordpress.org/support/users/prototypead/)
 * (@prototypead)
 * [8 years ago](https://wordpress.org/support/topic/cookie-block/#post-10264097)
 * Thank you for answering all my silly question [@fclaussen](https://wordpress.org/support/users/fclaussen/).
   It makes more sense now.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[GDPR] Cookie block](https://wordpress.org/support/topic/cookie-block/)
 *  [prototypead](https://wordpress.org/support/users/prototypead/)
 * (@prototypead)
 * [8 years ago](https://wordpress.org/support/topic/cookie-block/#post-10264020)
 * Thank you, so if we need to remove Facebook Pixel cookie, I would register it
   in the plugin and then add a helper function next to google analytics function
   with the new name and whatever FB pixel cookie is named. Something like that:
 *     ```
       function my_facebook_opt_out() {
         if ( is_allowed_cookie( '_fbq' ) ) {
       ....the rest code under here 
       ```
   
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[GDPR] Cookie block](https://wordpress.org/support/topic/cookie-block/)
 *  [prototypead](https://wordpress.org/support/users/prototypead/)
 * (@prototypead)
 * [8 years ago](https://wordpress.org/support/topic/cookie-block/#post-10263857)
 * Thank you, I understand legally you cannot advise, we are talking to some regarding
   that. I just wanted to make sure the code to use and how to use it is the right
   way.
 * So if we do not require a separate consent for google analytics, I would use 
   the code like this in the if section?
 *     ```
       function my_google_opt_out() {
         if ( is_allowed_cookie( '_ga' ) ) {
       ....the rest code under here as above
       ```
   
 * Can I use something like this:
 *     ```
       function my_google_opt_out() {
         if ( is_allowed_cookie( '_ga', '_gid' ) ) {
       ....the rest code under here as above
       ```
   
 * Thank you. I will google how to make google analytics data anonymous too. Good
   suggestion.
 * ALSO, currently we have the google tracking code in header.php file. Do I remove
   it from there when adding helper function in functions.php file?
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[GDPR] Cookie block](https://wordpress.org/support/topic/cookie-block/)
 *  [prototypead](https://wordpress.org/support/users/prototypead/)
 * (@prototypead)
 * [8 years ago](https://wordpress.org/support/topic/cookie-block/#post-10263744)
 * Hi, I am trying to understand how blocking/enabling cookies works. This thread
   has been helpful, I just want to put it in plain language what the steps are.
   Please let me know if they are correct.
 * 1. Identify Cookies used on the website
    2. Register cookies in the plugin under
   Cookies Tab 2a. Add Category name ‘analytics’ 2b. identify cookies used – ‘_ga,
   _gid, _gat’ 3. Add the code below in the functions.php file
 *     ```
       add_action( 'wp_head', 'my_google_opt_out' );
       function my_google_opt_out() {
         if ( ! has_consent( 'analytics' ) || ! is_allowed_cookie( '_ga' ) ) {
           ?>
           <script>
         (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
         (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
         m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
         })(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
   
         ga('create', 'UA-xxxxxxxxx-x', 'auto');
         ga('send', 'pageview');
   
       </script>
           <?php
         }
       }
       ```
   
 * But what does this do. If the cookies are off, then this function will not make
   them available and then google will not track? Do we need to create analytics
   consent too?
 * What about _gid and _gat? Does a separate helper function for each need to be
   added?
 * What if we have Facebook Pixel on the site? Is a new category need to be created
   and a new helper function in function.php file has to be added?
 * Thank you for your help, I know it is basic questions, but I just want to understand
   how to properly implement it.
 *   Forum: [Themes and Templates](https://wordpress.org/support/forum/themes-and-templates/)
   
   In reply to: [[Hestia] Custom Post Types](https://wordpress.org/support/topic/custom-post-types-322/)
 *  Thread Starter [prototypead](https://wordpress.org/support/users/prototypead/)
 * (@prototypead)
 * [8 years, 4 months ago](https://wordpress.org/support/topic/custom-post-types-322/#post-9869989)
 * Never-mind, had server issues. Everything works fine.

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