Delay loading scripts
-
Hi there,
in order to comply with the GDPR, I’m using Iubenda.
Unfortunately that plugin is not able to block the Google Analytics scripts because they’re loaded too soon.
Is there a way to lower the priority of these script inserted by Google Tag Manager for WordPress?
<script type="text/javascript" async="" src="//www.googleadservices.com/pagead/conversion_async.js"></script> <script type="text/javascript" async="" src="https://www.google-analytics.com/analytics.js"></script> <script async="" src="//www.googletagmanager.com/gtm.js?id=GTM-W7KS34V"></script>
I tried the following code, but it lower the priority of the tags:
function genuss_change_script_priority() { remove_action( 'wp_head', 'gtm4wp_wp_header_top', 1); add_action( 'wp_head', 'gtm4wp_wp_header_top', 5, 0 ); } add_action( 'init','genuss_change_script_priority' );
Thanks a lot,
Simone
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Delay loading scripts’ is closed to new replies.