Nginx proxy configuration for Google Analytics
Google PageSpeed Insights flags browser caching of Google Analytics:
Leverage browser caching
Set up a proxy in your Nginx configuration file to address this issue.
server {
### ...
location = /analytics.js {
# Proxy to google-analytics.com
proxy_pass https://www.google-analytics.com;
# Custom expires time
expires 1y;
}
}