1

I am getting this error:

Leverage browser caching
Setting an expiry date or a maximum age in the HTTP headers for static resources instructs the browser to load previously downloaded resources from local disk rather than over the network.
Leverage browser caching for the following cacheable resources:

http://www.google-analytics.com/analytics.js (2 hours)

This is my google analytics js code:

<script>
        (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
        (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
        m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
        })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

        ga('create', 'UA-35812981-4', 'auto');
        ga('send', 'pageview');
    </script>

There is only a very few question about this message on stackoverflow and the answer from them is not working for me. How can i rid of this message ? My score is 99/100, this is the only one. Can you help me with this ?

Attila Naghi
  • 2,535
  • 6
  • 37
  • 59

1 Answers1

0

A possible solution is to use this service. It provides a cached copy of the analytics.js that has a bigger time. You would just need to change the analytics link to this one: http://www.schedule-analytics.com/analytics.js

hoaphumanoid
  • 977
  • 1
  • 9
  • 25