/    Sign up×
Community /Pin to ProfileBookmark

track visitors

hello all,

I’ve been coding php for a while, but have never dealt with cookies, so don’t laugh if I’m off or if its too easy ?

I’ve got a site I need to track just the exit page of a client. I’m guessing that I would need some sort of a cookie as I want to mainly track those coming from a USAtoday advertising campaign we are doing.

To put it plainly, it wil be:
If refferrer=usatoday.com record exit page.

thanks in advance… not looking for a hand out, you can just forward me to a tutorial if need be.

Thanks,
ziggy

to post a comment
PHP

4 Comments(s)

Copy linkTweet thisAlerts:
@bathurst_guyJan 21.2007 — Where are you recording this information - in a cookie??? Doesn't make sense to me.

But you will need the [url=http://au.php.net/manual/en/reserved.variables.php]$_SERVER['HTTP_REFERER'][/url] and then it depends how you want to save the data - I don't think you really want to use cookies as you cannot access this information but if you saved this to a text file or a database it would be useable
Copy linkTweet thisAlerts:
@ziggy1621authorJan 21.2007 — getting the referrer is the easy part, I need to know IF they came from usatoday, what page did they leave my site on.

thanks,

ziggy
Copy linkTweet thisAlerts:
@NightShift58Jan 21.2007 — Instead of cookies, use sessions.

You will likely not be able to capture the "exit page" because when the user leaves a page, he also leaves your control.

The basic idea would be to set a session variable if the user came from "USA Today" and carry that session variable from page to page, as long as the user is viewing your pages.

You would need a database table where the session name and page name will be stored. Whenever the user enters a page, you need to replace the page name with the current page. The last page name so replaced will be the user's exit page.

You may also need some kind of timestamp mechanism if you need to keep track of the user's exit page by date or hour or whatever timeframe may be the case.
Copy linkTweet thisAlerts:
@ziggy1621authorJan 21.2007 — makes sense, I'll give it a go. Thanks.
×

Success!

Help @ziggy1621 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.7,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...