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.


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

| improve this answer | |

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 = http://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 HTTP:// and not HTTPS://

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.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.