简体   繁体   中英

Tracking Devices On same network or having same IP with php

I'm making a conversion tracking page with postback in php, for the same I need to generate a unique transaction ID on unique click. So for tracking unique clicks I'm tracking the user's IP address with $_SERVER['REMOTE_ADDR'] and generating transaction ID by md5($_SERVER['REMOTE_ADDR']) but there is a problem. Suppose there are some users using a WiFi network or due to some other reasons they have the same IP address so the transaction ID which will be generated would be same for them because of which I will not be able to track the conversion while actually in happened because of different devices.

Can anybody suggest to me the way to resolve this problem with php or javascript?

You could generate an ID of some sort and put a cookie on their machine containing that ID that will identify that browser.

This isn't perfect, but it might get you what you need.

Another way it to fingerprint the device and store the value. For example you can use https://github.com/jackspirou/clientjs to do what you need. There are a few other libraries out there that a google search will turn up.

Another possible way.

echo getenv("username");

The username used in windows.
But cookie is better as suggested earlier

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