revolunet / angular-google-analytics

Google Analytics tracking for your AngularJS apps
MIT License
652 stars 179 forks source link

Override scriptSource for setting up Expires or Cache-Control headers #200

Open sqrter opened 7 years ago

sqrter commented 7 years ago

Hi,

There's a common issue while optimizing Google PageSpeed insights score. The thing is that https://www.google-analytics.com/analytics.js is delivered with cache-control:public, max-age=7200 header which is only 2 hours. Though, recommended value is at least 1 week (https://developers.google.com/speed/docs/insights/LeverageBrowserCaching), so to get rid of the warning that PageSpeed insights generates and probably to increase it's score we have to deliver own copy of analytics.js or just proxy calls to www.google-analytics.com setting up needed headers for client-side caching.

Therefore it would be nice to have the domain as an optional parameter instead of herd coded string.