Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Tracking Referrals all the way through site. 1

Status
Not open for further replies.

Muppsy007

Programmer
Apr 4, 2003
98
0
0
NZ
Hi,

We are about to start a partnership with a similar company and will be x-linking.

However, our site is the only one of the two that sells online, so I want to have a way of keeping track of the people who buy after a referral from our partner.

Now, I know I could just do this by getting the partner to link directly to the order form and storing the $_SERVER['HTTP_REFERER'] in a database, but at the moment we want the link to go to a sort of "about us" page first.

So my question is, what sort of ways can I keep track of a user's orginal referrer, even if they go browsing the site before placing an order?

Any scripts/tutorials out there would be great. I can't seem to find anything except for over-the-top software and scripts on the web.

Thanks
Aaron
 
Just playing a round and think I may have found a way of doing it.

At the top of the entry page, I have the following code:

Code:
<?
session_start();
if(!session_is_registered('refer')) {
	session_register('refer');
	$HTTP_SESSION_VARS['refer'] = $_SERVER['HTTP_REFERER'];
}
?>

I outputted the $_SESSION['refer'] value to screen by clicking the link to the page on google. The full google url with search string was displayed.

I then went on a little browse throught the current site and returned to the entry page using the site navigation.

The output was google although I had come from an internal link.

So hopefully I can just run some code to database the relevant details if the $_SESSION['refer'] is that of our partner.

Can anyone see a problem with this? My session timeout in php.ini is set to 0 (browser close only).

Please any tips or concerns.

Aaron
 
Nope,

That stopped working altogether for some reason. No matter what browser I use, even if I just go from google to the entry page, $_SESSION['refer'] simply won't display any more.

Help please
 
Actually, I think my problem is when the site goes from normal, to secure and loses the session.

Is there any way to transfer this, or should would I better off using a database to manage my sessions and referals?

Or send the $_SESSION['refer'] in the url to the secure pages?
 
As for referals, What I would do is assign each their own number and give them a banner or custom button to use with the code and then use the code.
Code:
SESSION_START();
if (isset($_REQUEST['ref_id']) && !empty($_REQUEST['ref_id'])) {
$_SESSION['ref_id'] = (int)$_REQUEST['ref_id'];
}

Then to transfer the referal ID to the HTTPS I would imagine you could just use the same method.  I have very little experience going from HTTP to HTTPS though so I wouldn't know for certain.
 
Thanks Matt,

Your idea will do the trick.

Am passing the refid to the form on the secure page as a GET variable, and then assigning it to a hidden field to go with all the other feilds using post.

Done some tests, and works a treat.

Cheers
Aaron
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top