P
P
pantsarny2016-06-28 08:09:12
JavaScript
pantsarny, 2016-06-28 08:09:12

Cache page and Google Analytics. Works?

Good afternoon. There is a rarely measured HTML page with GA code and Metrics. If there is a page cache in the browser, the server does not resend the page, and returns a 304 code. Does GA work stably with pages from the cache? Will pageview tracking be sent? Have you encountered any problems in this situation?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrey Fedorov, 2016-06-28
@pantsarny

The logic here is this:
Search robot G tried to visit your indexed page. Your server replied - the page did not change. The robot moved on.
At the same time, the GA code did not start, since the robot and the server exchanged only HTTP headers.
The browser cache also does not work here, because. The 304 response is the server's response, but the client (browser) never gets through.
If we are talking about a site visitor:
He comes to the page. The server returns the code 200 because a 304 response requires a special request, which browsers don't do. Part of the data is loaded from the browser cache. The part is taken from the server. GA code is not cached because you simply don't have the option to configure its caching unless it's located on your server. GA works fine.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question