I have a Netlify function running that polls my site, ft.io, every minute to decide whether it needs to get new data and re-run the build.
This polling is polluting my analytics data because the dashboard doesn’t filter out requests from my function.
Can I filter these requests out? I’m not too concerned about implementation — filtering on IP range, special URL params, whatever. Just want to get these requests out of the dashboard.
Reading the Analytics docs, I found this paragraph:
The Pageviews, Top locations, and Top pages charts include only responses with Content-Type: text/html and a status code of 200, 201, or 304. We filter the data by status code this way so that we don’t count errors or double count redirects. This also applies to the Pageviews total for your site.
Given this information, I think I’ve fixed the issue, but I’d like confirmation. Quick summary of the issue and the fix:
Issue (prior to my post above)
Netlify function polls ../last-updated/, which returns an HTML file whose contents are a simple JSON string. (HTML because it’s the default type generated by my static site generator.)
Because it’s an HTML file, Netlify tracks each poll as a pageview.
Fix (current state): instead of returning and polling an HTML file at ../last-updated/, render ../last-updated.json. Because it’s a json file, Netlify Analytics should not track visits to this page. Is that correct?
If that’s correct, is there any chance the old requests to ../last-updated/ might be able to be purged from my analytics logs?