WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] [Plugin: W3 Total Cache] Google Analytics not working properly with W3TC. Share settings that work h (10 posts)

  1. Zemalf
    Member
    Posted 4 years ago #

    My Google Analytics hasn't been working properly since I started using W3 Total Cache. I'm using Joost's Google Analytics for WordPress plugin, but that's not the issue.

    I assume the problem is in the minify settings, so could someone tell what I shouldn't have ON there to ensure Google Analytics is working? e.g. HTML minify? JS minify? Line breaks?
    -->
    If someone is running both W3 Total Cache and Google Analytics is working as before, please share your settings, thanks!

  2. Frederick Townes
    Member
    Posted 4 years ago #

    This is actually a question for Joost. HTML minification probably needs to be completely disabled to leave the markup untouched. If you're trying to minify the google code embed, remove that from your JS minify settings.

  3. Zemalf
    Member
    Posted 4 years ago #

    You are right. I think taking HTML minification helped on this.

    The probably cause was the // comment on the code the Google Analytics for WordPress puts out. And when that is on single line it messes it up (or at least that caught my attention when I checked it).

    What do you think, can the HTML minification etc. be on if using "manually" inserted Analytics code?

  4. Frederick Townes
    Member
    Posted 4 years ago #

    Definitely, check out my site as an example.

  5. zamba
    Member
    Posted 4 years ago #

    I've been getting an intermittent error to do with this on one of my blogs:
    W3 Total Cache Error: Minify error: Unterminated String: "UA-146872-2

    This results in a blank page with the error on it until I empty the caches. It hasn't happened on any other one so far. I am using 2.9 and Joost's latest. Unfortunately, the error was caught by Googlebot, so it's currently enshrined at

  6. http://74.125.155.132/search?q=cache:6X7k3YkP5lcJ:www.travelsignposts.com/Germany/weather+W3+Total+Cache+Error:+Minify+error:+Unterminated+String&cd=2&hl=en&ct=clnk&gl=au
  7. and a partial load:

  8. http://74.125.155.132/search?q=cache:4_2xJMX6U0MJ:www.travelsignposts.com/Germany/food/rudesheim-asbach+W3+Total+Cache+Error:+Minify+error:+Unterminated+String&cd=3&hl=en&ct=clnk&gl=au
  9. As I have many blogs, it would be a bit of a pain to have to hand code analytics into them all, and I'd prefer to use the plugin. Have we got any more information on this?

    Tony Page

  • Frederick Townes
    Member
    Posted 4 years ago #

    Again, it's the obligation of plugin authors to ensure their plugins can work with minification. The FAQ suggests not minifying any statistics related scripts or code and again I'm encouraging you to disable HTML minification. Also the first link shows you running hypercache and not W3TC, the second shows the minification issue that Zemalf raised.

  • zamba
    Member
    Posted 4 years ago #

    Hi Fred,

    I was running hypercache, but deleted it when I switched to W3 Totalcache. Unfortunately the Google cache appears to have changed, and the first link doesn't produce an error now. In fact, for the same search this thread comes up first!

    I haven't had any problems since, but I've disable HTML minification in W3 TC as you recommended.

    I'm waiting for the 2.91 upgrade before rolling out the rest of the blog changes, but I have to say that W3 TC seems to be doing a great job speeding up my sites where implemented up to now. Looks like becoming the gold standard.

    Tony

  • Frederick Townes
    Member
    Posted 4 years ago #

    Ok great.

  • enailor
    Member
    Posted 4 years ago #

    So quick question about this... I typically hard code the GA code into the footer of my theme. Will any settings using the W3TC plugin have a negative effect on my GA readings if I manually install the code in the footer?

  • Frederick Townes
    Member
    Posted 4 years ago #

    No.

  • Topic Closed

    This topic has been closed to new replies.

    About this Topic

    Tags