Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
How to track traffic for leads?
Old 12-25-2009, 09:54 AM How to track traffic for leads?
Novice Talker

Posts: 6
Trades: 0
Hi,

I have a question about tracking CPA offers. I am not sure if this belongs to here though.

I have a wordpress website where I have CPA offers from one network, Maxbounty. And I have some other websites that I am sending traffic to my main website. I know how to create sub id's so that I can track which link generates clicks and leads.

Now what I want to do is to track the traffic from each website. I mean, let say website A, website B and Website C are sending traffic to the main site. How can I track which website's traffic generate me clicks and leads?

I know it is a bit complicated but the ones who do this would understand I guess.

Thanks.
ademmeda is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 12-25-2009, 03:53 PM Re: How to track traffic for leads?
lynxus's Avatar
Awesomeo-Maximo

Posts: 1,618
Location: UK
Trades: 1
PHP: show referring URL


Grabs the referring URL - get the HTTP_REFERER and save it to a variable.


code snippet: <?php

$ref
= getenv("HTTP_REFERER");
echo
$ref;

?>


Just put this on your "main" site and $ref will then have the url of sitea b or c in it.



For example, this is what i have on my website:

PHP Code:
<?php

# Gets the reffering site , Inserts into the private database for later graphing and documatiation.

$ipaddress $_SERVER['REMOTE_ADDR']; // Get the users IP ( so i can get their country code etc )
$refsite getenv("HTTP_REFERER");  //( Get the referring URL )
if ($refsite == "") {
    
$refsite "Unknown / Direct Visit"// If they visited directly
    
}

  
$con mysql_connect("localhost","database","**************");
if (!
$con)
  {
  die(
'Could not connect: ' mysql_error());
  }

mysql_select_db("database"$con);

$refsite mysql_real_escape_string($refsite);

mysql_query("INSERT INTO table (ref, ipaddress)
VALUES ('
$refsite', '$ipaddress')");

mysql_close($con);

?>
__________________

Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE



Last edited by lynxus; 12-25-2009 at 04:43 PM..
lynxus is offline
Reply With Quote
View Public Profile Visit lynxus's homepage!
 
Old 12-26-2009, 05:27 AM Re: How to track traffic for leads?
Novice Talker

Posts: 6
Trades: 0
Thanks a lot. It is apparent that what you suggest will solve my issue. However, I am not much php savy, and don't know how to implement your code. Could you please lead me to a step by step source that I can follow, if there is any.
ademmeda is offline
Reply With Quote
View Public Profile
 
Old 12-26-2009, 06:43 AM Re: How to track traffic for leads?
lynxus's Avatar
Awesomeo-Maximo

Posts: 1,618
Location: UK
Trades: 1
OK,
Create a mysql database and table like :

CREATE TABLE IF NOT EXISTS `visits` (
`id` int(100) NOT NULL auto_increment,
`ref` varchar(1000) character set utf8 collate utf8_unicode_ci NOT NULL,
`time` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
`ipaddress` varchar(100) NOT NULL default '0.0.0.0',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

Then use the code:

PHP Code:
 <?php

# Gets the reffering site , Inserts into the private database for later graphing and documatiation.

$ipaddress $_SERVER['REMOTE_ADDR']; // Get the users IP ( so i can get their country code etc )
$refsite getenv("HTTP_REFERER");  //( Get the referring URL )
if ($refsite == "") {
    
$refsite "Unknown / Direct Visit"// If they visited directly
    
}

  
$con mysql_connect("localhost","databasename","password"); // Maybe uname :root  password blank""
if (!$con)
  {
  die(
'Could not connect: ' mysql_error());
  }

mysql_select_db("YOURDATABASENAME"$con);

$refsite mysql_real_escape_string($refsite);

mysql_query("INSERT INTO visits (ref, ipaddress)
VALUES ('
$refsite', '$ipaddress')");

mysql_close($con);

?>
This is pretty much all the info i can give you short of doing ti all myself..


good luck
-G
__________________

Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE



Last edited by lynxus; 12-26-2009 at 06:44 AM..
lynxus is offline
Reply With Quote
View Public Profile Visit lynxus's homepage!
 
Old 12-26-2009, 08:03 AM Re: How to track traffic for leads?
Novice Talker

Posts: 6
Trades: 0
Well, thanks for trying to help me. I guess I will need to pay someone to do this for me, because it seems that I will not be able to do that.
ademmeda is offline
Reply With Quote
View Public Profile
 
Old 12-26-2009, 08:13 AM Re: How to track traffic for leads?
lynxus's Avatar
Awesomeo-Maximo

Posts: 1,618
Location: UK
Trades: 1
statcounter.com is a free traffic counter.
Add it to your "main" page.
Then login to statcounter and you can see ( on the left ) your most recent came from .

This will show what page your traffic is coming from.
__________________

Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE


lynxus is offline
Reply With Quote
View Public Profile Visit lynxus's homepage!
 
Old 12-27-2009, 11:23 PM Re: How to track traffic for leads?
Extreme Talker

Posts: 185
Trades: 0
I think is better to use google analytics and setup goals, it would be much better and more accurate.
__________________

Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE
weker is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to How to track traffic for leads?
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.49696 seconds with 12 queries