Cookie gets changed when hit comes from a referrer

Joel Goldstick joel.goldstick at gmail.com
Tue Oct 8 13:47:14 EDT 2013


On Tue, Oct 8, 2013 at 1:30 PM, Νίκος Αλεξόπουλος <nikos.gr33k at gmail.com> wrote:
> Is there any better way to identif a previous visitor? i tried cookies which
> failed for me for the reason i opened this thread and host like follows:
>
>                 # try to locate the visitor
>                 cur.execute('''SELECT * FROM visitors WHERE counterID = %s
> and host = %s''', (cID, host) )
>                 data = cur.fetchone()
>
>                 if not data:
>                         # if first time visitor on this page, create new
> record
>                         cur.execute('''INSERT INTO visitors (counterID,
> host, city, useros, browser, ref, lastvisit) VALUES (%s, %s, %s, %s, %s, %s,
> %s)''',
>                                                    (cID, host, city, useros,
> browser, ref, lastvisit) )
>                 else:
>                         # since visitor exists just update his record
>                         cur.execute('''UPDATE visitors SET city = %s, useros
> = %s, browser = %s, ref = %s, hits = hits + 1, lastvisit = %s''', (city,
> useros, browser, ref, lastvisit) )
> =======
>
> Please tell me if you can think fo something else.

Yes! there is a very simple and comprehensive way to learn about your
visitors.  Use Google Analytics.  Its free, you only need a google
account to open an analytics account.  They give you a small bit of
javascript that you copy and past to your pages.  If you are using a
template to create your pages, this is easy, since you just add google
code to the template.
>
> --
> https://mail.python.org/mailman/listinfo/python-list



-- 
Joel Goldstick
http://joelgoldstick.com



More information about the Python-list mailing list