Can the piwik js file be cached?


#1

can the piwik js file be cached?


(vipsoft) #2

Yes


#3

That means it will affect my stats ?


(vipsoft) #4

It’s ok to cache piwik.js. It’s a static resource.

Conversely, it is not ok to cache the output from piwik.php.


#5

Thanks for explain. Question is my developer team want to cache this file and they want to put some expiration time something like that so page or apps load pretty fast. Is this possible i explicity specify to cache this file?


(Matthieu Aubry) #6

Yes you can


#7

@matt - where do i tell to cach piwik.js file ? How ?


#8

If you are running Apache try this:
(httpd-vhosts.conf or httpd-ssl.conf)

    <Directory /directory/path/to/piwik/>
    ExpiresActive On
    ExpiresByType application/javascript "access plus 1 week"
    ExpiresDefault "now"
    </Directory>

You will need mod_expires loaded

This config tested in Apache 2.2 and 2.4.


(Farid Nasiri) #9

@matthieu
FlowerPowerNZ

above code helped ,but status code is 200 instead of 304
is it normal?
thanks