: How to view how many visitors visited Page X and then (in same session) Page Y? I want to get a rough idea of how many visitors who visited Page X then eventually visit Page Y (in the
I want to get a rough idea of how many visitors who visited Page X then eventually visit Page Y (in the same session).
I know that I can use this method but they might not visit Page Y as their next click. And I don't want to have to hunt through all the pages visually.
More posts by @Pope3001725
2 Comments
Sorted by latest first Latest Oldest Best
Here is two ways to do it:
The first is to use http_referer in PHP on page Y. A simple way to do it is get the HTTP_REFERER address. Then do if $http_referer = example.com/pageX { file_put_contents (log.txt);
The above method will log how many people came from page X. Note that this only works if you are using and not
The second method is as follows:
When a user goes to page X, log their IP using $_SERVER['REMOTE_ADDR'] in PHP. You can do $ip = $_SERVER['REMOTE_ADDR']; and then put $ip in file_put_contents('.$ip.'.txt);
Then on page y, do $ip = $_SERVER['REMOTE_ADDR']; file_get_contents('.$ip.'.txt);
If # of characters in $ip > 0 { file_put_contents $ip into pageylog.txt
If you work out the above code, this is what will happen: Every time a person visits page X you record their IP in a .txt file. Whenever a person visits page Y, you load their IP from that .txt file. If that .txt file doesn't exist, nothing happens. If it does, you record it into a new .txt file. That new .txt file will tell you how many people visited page X as well as visited page Y.
Construct a segment - conditions - sessions include page Y, then add that segment to your report and look at page x figures, you'll only be seeing the sessions that also looked at page Y
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.