Problem with the Hook for GTM4WP
-
Hi,
I’m using the code pointed in this post for the GTM4WP, but there’s some kind of problem that once the user click on the “Accept” button the banner doesn’t disappear and in the console there’s an js error:
Uncaught TypeError: URL constructor: //www.googletagmanager.com/gtm.js?id=GTM-NZX5X6P is not a valid URL. c https://mysite.com/wp-content/plugins/gdpr-cookie-compliance/dist/scripts/main.js?ver=4.9.4:1 d https://mysite.com/wp-content/plugins/gdpr-cookie-compliance/dist/scripts/main.js?ver=4.9.4:1 init https://mysite.com/wp-content/plugins/gdpr-cookie-compliance/dist/scripts/main.js?ver=4.9.4:2 jQuery 9 gdpr_lightbox https://mysite.com/wp-content/plugins/gdpr-cookie-compliance/dist/scripts/main.js?ver=4.9.4:1 <anonymous> https://mysite.com/wp-content/plugins/gdpr-cookie-compliance/dist/scripts/main.js?ver=4.9.4:1 <anonymous> https://mysite.com/wp-content/plugins/gdpr-cookie-compliance/dist/scripts/main.js?ver=4.9.4:1
This is the filter thar I use from this post
add_filter( 'gtm4wp_get_the_gtm_tag', 'gdpr_cookie_compliance_gtm4wp' ); function gdpr_cookie_compliance_gtm4wp( $gtm_script = '' ) { if ( function_exists( 'gdpr_cookie_is_accepted' ) ) : return gdpr_cookie_is_accepted( 'thirdparty' ) ? $gtm_script : ''; else : return $gtm_script; endif; } add_action( 'gdpr_force_reload', '__return_true' );
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Problem with the Hook for GTM4WP’ is closed to new replies.