I am using PhantomJS and the rasterize.js example to capture a screenshot of my website. The process is automated and a new screenshot is taken every five minutes to check the status of the website. I am using Google Analytics to track users on my website and would like to exclude the traffic generated by PhantomJS. To do this I am setting a _setVar cookie in the rasterize.js file and creating a custom filter in Google Analytics to filter out the traffic. For some reason this isn't working and I can't figure out why. I use the following code in rasterize.js to set the cookie:
phantom.addCookie({
'name': '_setVar',
'value': 'ignore_analytics',
'domain': 'MyWebsite.io'
});
This method should work, but when I look at the real time traffic on my website in Google Analytics, the PhantomJS clients still show up. Why isn't this working?
page.customHeaders. - Artjom B.