Will Google Analytics be recording page views / events from within a Live Preview? And if so, is there a way to prevent this from happening?
My understanding is that with Google Analytics you can set the domain for which it should track (e.g. to prevent it trying to track any local build events etc), but I am presuming that the domain used for Live Preview views will be the same as as if a user was viewing the front end of the site?
If it would track Live Preview views, I understand that an option for some people would be to wrap their GA code block in a conditional:
{% if not craft.request.isLivePreview %}{# ga code here #}{% endif %}
but because we have custom event tracking built into the JS, which therefore uses the global ga
object, it would not be as simple in our case (though is still an option with a few checks for whether ga
is defined).