Title: ftwseboki's Replies | WordPress.org

---

# ftwseboki

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

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

 Search replies:

## Forum Replies Created

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

 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[GDPR Cookie Compliance - Cookie Banner, Cookie Consent, Cookie Notice for CCPA, EU Cookie Law] Adding AW-XXXXX to track google ad conversions](https://wordpress.org/support/topic/adding-aw-xxxxx-to-track-google-ad-conversions/)
 *  [ftwseboki](https://wordpress.org/support/users/ftwseboki/)
 * (@ftwseboki)
 * [4 years, 6 months ago](https://wordpress.org/support/topic/adding-aw-xxxxx-to-track-google-ad-conversions/#post-15103170)
 * Well with the possibility of using hooks I think the GDPR cookie plugin is really
   a great plugin and the features already in the free version are really great.
 * It is not a plugin that is giving us a hard time with the marketing efforts rather
   than the laws. They say you have to opt in, not the plugin 😉 With this plugin
   you can do as you like – opt-in or opt-out. Using opt-out: you take the risk.
 * And the solution above should work as opt-out (as you say you want to use it)
   as well. It just a matter of the options you select within the plugin. If you
   choose to activate the Third-Party-Cookies by default, they should be delivered
   as opt-out – no mater if you choose the standard ajax method or the way with 
   the hooks. It’s just a different method how the scripts are served.
 * And having a well functioning WordPress plugin is so much easier and seamless,
   that with lot’s of other cookie solutions that are implemented in different ways.
   By this plugin you have the control (though you need to know what you are doing),
   that’s what I really like.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[GDPR Cookie Compliance - Cookie Banner, Cookie Consent, Cookie Notice for CCPA, EU Cookie Law] Adding AW-XXXXX to track google ad conversions](https://wordpress.org/support/topic/adding-aw-xxxxx-to-track-google-ad-conversions/)
 *  [ftwseboki](https://wordpress.org/support/users/ftwseboki/)
 * (@ftwseboki)
 * [4 years, 6 months ago](https://wordpress.org/support/topic/adding-aw-xxxxx-to-track-google-ad-conversions/#post-15103016)
 * Well I am not a lawyer, so I can’t give you any secure advice. But as far as 
   I know: With the new cookie laws, all tracking scripts an all third-party cookies
   that are not in the basic functional level for the website have to be approved
   first. For instance in Germany the TMG is the new local law from December 1st
   2021, meaning that the user has to give consent first. That’s how I understood
   it.
 * I know that is hard for monitoring. But that is why so many big websites switched
   to no preselected tracking options and the inclusion of reject buttons as well
   as tracking only after opt-in these days.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[GDPR Cookie Compliance - Cookie Banner, Cookie Consent, Cookie Notice for CCPA, EU Cookie Law] Adding AW-XXXXX to track google ad conversions](https://wordpress.org/support/topic/adding-aw-xxxxx-to-track-google-ad-conversions/)
 *  [ftwseboki](https://wordpress.org/support/users/ftwseboki/)
 * (@ftwseboki)
 * [4 years, 6 months ago](https://wordpress.org/support/topic/adding-aw-xxxxx-to-track-google-ad-conversions/#post-15102929)
 * Hi [@dav74](https://wordpress.org/support/users/dav74/),
 * Yes, you should still disable the ajax injection via functions.php I guess. Because
   by using the hook, you are not injecting the script anymore rather than deliviering
   it within the page source code. If you leave the ajax injection untouched, ajax
   would inject the code you saved in the plugin – which is now reduced to <script
   ></script> – which means empty 😉
 * So if you are only blocking the script if a user is rejecting the settings (be
   careful, it is a violation of the new cookie laws as far as I know within the
   EU), you still want the code to be loaded by the hook (where it is placed) and
   not by ajax (which would only call <script></script>). So that is why you deactivate
   ajax anyway in this special case.
 * Please note: if you have other scripts inside the Plugin aside Google Ads/Conversion,
   you would have to use them via the hook-method as well! Because when you deactivate
   the ajax, they aren’t handled anymore.
 * Now having the possbility of using the hooks is an awesome job by [@mooveagency](https://wordpress.org/support/users/mooveagency/)
   making this plugin really versatile. It helps solving a correctly working integration
   of scripts such as the google ads conversion tracking. Somehow the ads conversion
   snippet is really picky and needs the script to be hardcoded at the first call
   of the page rather than a later injection via ajax to work porperly with the 
   second conversion snippet in the e-mail form or wherever it is used. If you do
   only use Analytics, it doesn’t matter. It’s only needed to make Google Ads Conversions
   work 😉
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[GDPR Cookie Compliance - Cookie Banner, Cookie Consent, Cookie Notice for CCPA, EU Cookie Law] Adding AW-XXXXX to track google ad conversions](https://wordpress.org/support/topic/adding-aw-xxxxx-to-track-google-ad-conversions/)
 *  [ftwseboki](https://wordpress.org/support/users/ftwseboki/)
 * (@ftwseboki)
 * [4 years, 6 months ago](https://wordpress.org/support/topic/adding-aw-xxxxx-to-track-google-ad-conversions/#post-15102616)
 * Hi dav74,
 * I ran into the same issue. Analytics get’s fired, ads conversions not.
 * But there is a way which was working perfectly: Don’t integrate your script in
   the plugin directly. Use the “HOOK to GDPR custom 3RD-PARTY script by php – HEAD”
   option instead. It is documented in detail in the plugins help section as well.
   Here’s how you set it up:
 * Important: Leave a blank <script></script> tag in the plugin at the place where
   you had your script so far. It was third party cookies / head in my case. Otherwise
   the following step will not fire – if the field in the plugin is completely blank.
 * Next you open your theme’s header. At the place where you want the script to 
   be added, you enter the following (I would place it after wp_head(); ):
 *     ```
       if(function_exists('gdpr_cookie_is_accepted')){
         /* supported types: 'strict', 'thirdparty', 'advanced' */
         if(gdpr_cookie_is_accepted('thirdparty')){
         ?>
           <script async src="https://www.googletagmanager.com/gtag/js?id=UA-XXXXXXX-3"></script>
           <script>
              window.dataLayer = window.dataLayer || [];
              function gtag(){dataLayer.push(arguments);}
              gtag('js', new Date());
              gtag('set', {cookie_flags: 'SameSite=None;Secure'});
              gtag('config', 'UA-XXXXXXX-3',{'anonymize_ip':true});
              gtag('config', 'AW-XXXXXXX');
       </script>
       <?php
         }
       }
       ```
   
 * I would add the anonymize IP option as well on the UA gtag.
 * Since the code is now only embedded with accepted third party cookies and the
   ajax script loading was the problem for the ads code not to fire, I would add
   the following to the theme’s functions.php:
 *     ```
       /*Disable Ajax Injection*/
       add_action( 'gdpr_cc_prevent_ajax_script_inject', '__return_true' );
       /*Force page to reload*/
       add_action( 'gdpr_force_reload', '__return_true' );
       ```
   
 * The second option is important if you want the conversion tag to fire on the 
   same page – because it is only loaded into the code once the page loads and the
   cookies are accepted.
 * Hope this helps, for me it did 😉

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