• Resolved temposaur

    (@temposaur)


    Google Analytics -plugin won’t work with w3totalcache out of the box.

    But with this small modification, it will:

    Replace file content from view/ga_googleanalytics_loader.php
    with this:

    <?php
    $js = "
    <script>
        jQuery(document).ready(function () {
    		jQuery.post('".esc_attr( $ajaxurl ) ."', {action: 'googleanalytics_get_script'}, function(response) {
    			var F = new Function ( response );
    			return( F() );
    		});
        });
    </script>";
    
    wp_add_inline_script("google_analytics", $js, 'after');
    

    It will now allow js-script to be minified and placed in right position when using w3totalcache.

  • The topic ‘Google Analytics -plugin with W3Totalcache’ is closed to new replies.