0

I have a url shortener that I created to track incoming links. Currently the php sets a cookie and inserts visitor information into the database. It attaches an id to the redirect url and redirects the user to the website.

The website has javascript on the page that takes the id and tries to set a cookie on the front end. If cookies are disabled, the javascript attempts other things to store that id. The reason I am setting the id is due to the javascript sending random pieces of information to the backend.

Is there a way for php to have a fallback if the person doesn't have cookies enabled? I don't want to create a new database entry for someone who visits the same link multiple times who doesn't have cookies enabled. Don't want to be tracking the same person as 2 or more people.

Edit If I can't prompt the user that their cookies are disabled, are there any alternatives?

2nd Edit One of the comments brought this up, so I thought I'd post the link here: User recognition without cookies or local storage

Community
  • 1
  • 1
Brian Putt
  • 1,168
  • 2
  • 12
  • 32
  • 1
    possible duplicate of [Check if cookies are enabled](http://stackoverflow.com/questions/6663859/check-if-cookies-are-enabled) – Peter Oct 10 '13 at 20:38
  • http is a stateless protocol –  Oct 10 '13 at 20:39
  • 1
    you've got 2 methods of tracking returning visitors: IP addresses and cookies. IPs are incredibly unreliable, and cookies can't be depended on either. In other words, tracking users on the web is "do the best job you can, but don't expect 100% accuracy" – Marc B Oct 10 '13 at 20:39
  • I guess if I can't prompt the user that their cookies are disabled, then I guess the best job scenario comes to play ha – Brian Putt Oct 10 '13 at 20:42
  • @Mark B, you are right - but we hear all the time in the media that websites is "tracking users" anyway. – davidkonrad Oct 10 '13 at 20:45
  • 1
    And what if the user disabled JavaScript? The best answer I found on stackoverflow on this subject is [this one](http://stackoverflow.com/questions/15966812/user-recognition-without-cookies-or-local-storage/16120977#16120977). A must read. – HamZa Oct 10 '13 at 20:45
  • ^^^ some people have to much free time :-) –  Oct 10 '13 at 20:49
  • @HamZa wow great find, thx – Brian Putt Oct 10 '13 at 20:49
  • @Dagon Says a user with 9K rep :-) – HamZa Oct 10 '13 at 20:51

0 Answers0