简体   繁体   中英

Proper Way of Recording Page Views

What is the proper way, using PHP, to record web page views? I believe that currently we just record a view each time a page is hit on, but I am assuming that is including hits from bots, or other things we don't want to be recording.

How can we just record real legit views into our DB and not include stuff that shouldn't be counted as an actual page view?

Thanks!

Use google analytics

To set up the web tracking code:

Find the tracking code snippet for your property. Sign in to your Google Analytics account, and select the Admin tab. ... Find your tracking code snippet. ... Copy the snippet. ... Paste your snippet (unaltered, in its entirety) into every web page you want to track. ... Check your setup.

1) Ignore any known bots that visits your web page. (best use robots.txt )

2) Use Ajax call at the end of page to get rid of bouncers (visitors that opens web by mistake and closes it before everything is loaded).

3) I assume you can call Ajax in some delay, so robots will already has left your page and visitor is still browsing it.

4) Record IP addresses and (if possible) some device identifier to find unique visitors.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM