Forum Moderators: phranque

Message Too Old, No Replies

Can someone please help with some info?

Creating an Incentives Based WebSite

         

kentuckyslone

4:10 pm on Jul 16, 2005 (gmt 0)

10+ Year Member



I have asked this question before in a different part of this forum and in several other forums. But in over a months time I have not gotten an answer. So I thought that I would post it in this section.

I am working on creating an incentives site. That is people join and they are paid for actions such as signing up for free offers, trials, services, shopping etc.

I already have the affiliates and advertisers lined up.

What I need to know is how do I have it so that when a member is logged in their link is dynamically appended with a sub ID so that they can be tracked for completing an offer?

Can anyone tell me what I need to do or what script I need to obtain to accomplish this?

Thanks in aadvance to anyone who offers advice and info
David

Anyango

5:10 pm on Jul 16, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



David!

Welcome to this Forum. I am more then willing to help you sort out this issue, However if you can please expmain the current scenario a bit more , like:

What exactly is Currently Missing and is needed to be done, I mean currently when members sign in what information do you store and what is the link between members and SUB IDs, stuff like that. You mean you want to track IDS of Affiliates who are bringing in more members to your site?

Thanks
Kami

kentuckyslone

10:22 pm on Jul 16, 2005 (gmt 0)

10+ Year Member



Currently I am creating a seperate directory for each member. When they log in they are redirected to their particular directory (loginwa script)

Naturally this is not a good method as I am having to manually set the urls to track the sub IDS for each member. So I am accumulating a LOT of directories with exaclty the same pages in each except for the sub IDs.

All I need to do is have it so that I have only 1 set of pages and when a member logs in their sub id is automatically (dynamically) appended to any url they click (ie to complete an offer or sign up) so that I can know who to credit for an action. That is - when I log into my affiliate accounts to see credits they are listed by sub IDs. I can then know who that sub ID represents and apply credit to their account.

David

Anyango

11:13 pm on Jul 16, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



David!

That can be done using a combination of .htaccess + some php code and ofcourse MySQL database. I have been doing alot of work like this where we had to create dynamic sub-domains by code without any need of creating directories by hand..

This is real easy.

I 'll post my detailed message in a few hours, Time to take some rest.

Have a nice Day
Kami

kentuckyslone

3:15 am on Jul 17, 2005 (gmt 0)

10+ Year Member



Thank you Kami

I really do appreciate it a lot. It may be simple nad easy for you but I'm relatively new to MySQL and php etc., though I have been using HTML for a long time.

But, I do have MySQL etc. so if it can be done I can do it with the right info.

David

jomaxx

5:55 am on Jul 17, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If the whole signup process takes place on one domain, then the whole thing can be done with cookies. Set a cookie when they sign in and save a record of it when they complete an offer.

If you're sending people to other domains, you can dynamically create the URLs with cookies and Javascript. Use document.write to write out the HREF tags. Or alternatively, you can use the onClick condition to dynamically add the tracking code when they click on a certain link.

jomaxx

6:01 am on Jul 17, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



P.S. If these are affiliate programs you're signing up with via CJ or whoever, I hope the merchant is fully aware you're sending incentivized traffic.

kentuckyslone

6:47 am on Jul 17, 2005 (gmt 0)

10+ Year Member



Thanks Jomaxx,

All of the affiliates know that it is an incentives site. As for CJ it is flagged and described as an incentives site. I know you aren't making accusations but I just want to say I am building up an honest and legitimate site.

The offers are completed on various domains. All of the links are on the same domain. I am new to working with databases and php, cookies etc.

David

kentuckyslone

6:51 am on Jul 17, 2005 (gmt 0)

10+ Year Member



Sorry by the time I got to the reply screen I had forgotten a couple things you wrote

"Use document.write to write out the HREF tags. Or alternatively, you can use the onClick condition to dynamically add the tracking code when they click on a certain link."

I dont really understand that - Im learning though

David

jomaxx

4:22 pm on Jul 17, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Here's a brief example that shows you how the onClick works. When the link is clicked, the addCode Javascript function is executed. It takes the URL and adds whatever tracking code you wish (based on the value saved in a cookie).


<SCRIPT>
function addCode(externalURL) {top.location=externalURL+'?code=12345';}
</SCRIPT>

<A HREF="http://www.webmasterworld.com/" onClick="addCode('http://www.webmasterworld.com/'); return false;">Click Here</A>

This is a very simple demonstration, but to manage signups, handle cookies, and make the whole thing fit together you're going to need some basic programming skills, or find someone who's got them.

kentuckyslone

4:43 pm on Jul 17, 2005 (gmt 0)

10+ Year Member



Hi Jomaxx

I do have some basic skills but thats about it.

I am using MySQL and a php script (loginwa) to manage log ins.

So could I add the cookie and the above javascript while still using the ame login method?

David

jomaxx

5:18 am on Jul 18, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I don't know the specifics of your setup, but in general you could do it by setting a cookie at login and querying it in Javascript, or you could do the whole thing dynamically in PHP.

Anyango

7:56 pm on Jul 18, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



David!

Sorry i was out of town.

Please check this discussion

[webmasterworld.com...]

I know you mentioned that you are not expert in PHP, but please check the concept that we have disussed on that topic and if you like the concept, i can fully help to set up your system

Please let me Know.

Thank You

Kami

kentuckyslone

6:14 am on Jul 19, 2005 (gmt 0)

10+ Year Member



Hello Kami,

I read through the post you referred to. I understood very little of it :O)

I mean I did uderstand the concept but I didnt quite understand how to implement it.

To be sure it will work for what i need let me give a quick example:

Lets say I have a page that has 8 different links on it to go to affiliate sites.

When a member logs in I want them all to go to that same exact page. But whenever they click on one of the links I need for a sub ID to be dynamically added to the end of the url so that I can easily identify who it was that did the action.

The script that you are referring to will do this? If so then I would really be interested in doing it.

I have installed several php scripts for myself and others and I do have general knowledge on creating MySQL dbs

David

Anyango

11:16 am on Jul 19, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hey David!

Its good you got the idea, i think i overlooked the issue and went to deep. the issue you are reffering to, is simple and easy to be resolved.

Let me explain

Let us say you have a page index.php where you members reach after they login to your system, and on that index.php let us say you are showing some links. Now you want that whenever any member clicks on the link you get his id added to that url so that you can check who clicked it. do you think i am getting it right?

if yes

1) It is clearly simple, your 8 links are generated from database or hand entered links? i think hand entered links.
2) Do they go directly to the sites you want to send them or you use your own redirect pages?

Clarification of question 2:

are links like this

[go-to-site1.com...]
[go-to-site2.com...]
[go-to-site3.com...]

or something like this

redirect.php?url=http://go-to-site1.com
redirect.php?url=http://go-to-site2.com
redirect.php?url=http://go-to-site3.com

Question 3) The Eight sites for example, which you want guys to send to, are Yours? in your control? i think NO.

Before proceeding further from this point, Please keep answers to above three questions ready.

If the links go to those sites directly

i. e

[go-to-site1.com...]

then you need to create a small redirect.php file (which i can do for you if you like) which will take two parameters

1) URL where to send
2) ID of the member who is requesting it

so the call will change like

redirect.php?url=http://go-to-site1.com&memberid=10
redirect.php?url=http://go-to-site1.com&memberid=2

or any member ID.

Now there comes another question, if the scripts which you have already provide you reports of clicks that are being made and they show you URL that was browsed, thats fine, that will show you like

redirect.php?url=http://go-to-site1.com&memberid=2

so you can check that above line says that the member number 2 clicked on [go-to-site1.com...]

but if you do not have reports currently, Then in your redirect.php, we can add some small code that will save that information into a table in your MySQL database and then in your amin.php or report.php you can call a script to load values from that log table which redirect.php has been adding data to.

That way you ll be able to clearly identify which guy went where, when and how.

If I am guiding in the right direction, Please let me know, i am here to help you in anything even if you like me to write you those codes for you, it will be my pleasure.

let me know please and feel free to ask anything

Thanks
Kami

kentuckyslone

11:55 am on Jul 19, 2005 (gmt 0)

10+ Year Member



Hello Kami,

Thank you so much! that was an exceelent post! I really appreciate all the time you took with that. And yes you do understand what I am trying to accomplish. I will be using more than just the one page of 8 links however. I plan to use at least 15 different pages with 8 or so on each one.

To answer some of your questions:

The links are added by hand

All links will lead directly to different sites, none of which are under my control.

I dont have scripts that provide me with reports of clicks. This function lies within my main affiliate accounts where I will log in to check the reports (although these reports are usually limited). It would be great to have click reports through MySQL db!

I would truly appreciate your help and would (already do) feel indebted to you.

David

Anyango

2:02 pm on Jul 19, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hey David

I am very happy to see you satisfied with our discussion, you are just one step away from accompolishment of your task.

Please allow me a few hours to get you php code that would work exactly as we discussed, meanwhile you do please some research on your existing code that when a user logs in to your system right, does your system store his username or userid in either a PHP session or a cookie or does it pass that username to your default landing page?.

for example if after logging in a user is sent to

index.php

in the browser do you get just /index.php or some sort of id too?

like /index.php?user=David
or /index.php?userid=6

Even if your script doesnt save current user data in either sessions or cookies or it doesnt send it to your main landing page, thats fine we wll have to add some lines of code but if it does that will expedite the process.

While i prepare my next message, Please check with the existing code for the things i mentioned above.

They Say
"When there is a Will , There is a Way"

Kami

kentuckyslone

3:28 pm on Jul 19, 2005 (gmt 0)

10+ Year Member



Kami

Currently when a user logs in they are redirected to their own particular folder. I have created a different folder for each member with duplicate pages (WHEW Thats too much time and work) each page within their folder has code at the top to limit access to only that user or an administrator. If I change this to have all users allowed access will that work with this system we are discussing? Or will I not need to do this step at all? (The script I am using is loginwa)

With the new system I will be redirecting all members to an index.php

David

Anyango

4:08 pm on Jul 19, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



David!

You are tiring yoruself bro by making more and more directories for new users and duplicating pages. Apart from time this poses a serious question, if one day you have 500 users and you decide to change <Title> tag of your pages to be at least, you ll have to open 500 directories and pages within them to implement the change on all pages.

But dont worry, I am arranging stuff for you.

Cya in few.

Kami

kentuckyslone

4:23 pm on Jul 19, 2005 (gmt 0)

10+ Year Member



Thank you so much!

Well, I do use php includes so if I decided to change something like that it wouldnt be a problem BUT when a particular offer is deactivated or when a new one is added I do have to go to every directory and make the changes - NOW that IS a lot of work.

I am on a very low budget as I am just starting out but I wish that I could pay you something. It is definitely worth it to me. I have been trying to find a solution to this problem for well over a month with no luck. I actually stopped advertising and promoting the site at all until I can get this straightened out.

David

Anyango

4:35 pm on Jul 19, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hey David

No no bro there isnt any thing related to payment. Webmasterworld has setup this forum where we can assist each other some way or other. Please feel free to discuss anything without thinking of needing to pay me or someone here. I am helping you as brother and there is no way i can even think of any payment sort of thing.

If with my assistance your system gets working as you expect it to work, thats the best reward one can have.

I ll post my next code shortly.

Cheers
Kami

kentuckyslone

12:53 pm on Jul 21, 2005 (gmt 0)

10+ Year Member



Thanks Kami,

If there is anything that I can to help you or others in this forum I will try to do it

David

Anyango

6:24 am on Jul 22, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



David!

Sorry i temporarily lost my internet connection that is why couldn't post my message in time, i ll post it shortly.

Thanks

Kami

Anyango

3:06 pm on Jul 25, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi David

First of all i sincerely appologize that i have been unable to post my promised message over the whole week and even
after messaging again that i will post my message shortly, I have been unable to. I have had a really bad week
regards to my Internet connection, There was a serious problem in data transmission lines of my isp that is why i couldnt
come over to internet.

Without wasting your further time, i would like to start the discussion from where we ended.

Now 1st thing that you need to do, is that as you said that when any user logs in you send them to their
specific directories which no other user can access, this means that at the time of login, in the login script
there comes a stage where you get to know the "username" of the user that is logging in, then you send that
user to his specific directory.

Now, At that point, save the username into a PHP Session Variable (i prefer not to use cookies because of their inceased
bad reputation and blockage by many anti-spywares.)

<?
session_start();
global $username;
$_SESSION['username']=$sRecordSet['username'];

?>

Now you have that username stored in a global session variable, you can simply send the person to standard index.php

Now on your index.php you put any/all the affiliate links you want to , or you can create multiple .php pages as you mentioned
and place your affiliate links on them.

Now when you place links like this

<a href='http://affiliatelink1.com'>Affiliate Program 1</a>

change it a little bit and make it like this

<a href='browse.php?page=page1&resource=http://affiliatelink1.com'>Affiliate Program 1</a>

do the same thing for any number of links you like to place on any number of pages

<a href='browse.php?page=page1&resource=http://affiliatelink1.com'>Affiliate Program 1</a>
<a href='browse.php?page=page2&resource=http://affiliatelink2.com'>Affiliate Program 2</a>
<a href='browse.php?page=page3&resource=http://affiliatelink3.com'>Affiliate Program 3</a>

this simply sends two parameters to our browse.php

1) which is the current page on which user has clicked on a link = "page"
2) which link user wants to go to = "resource"

Now comes the time when we have to log, which user has clicked on which link

now create a MySQL Table named 'clicks' and add following fields.

or na, leme create it in my MySQL and copy paste you the SQL Query you need to create the table. just a second

-------------------------------

CREATE TABLE clicks (
clickid bigint(20) NOT NULL auto_increment,
username varchar(50) NOT NULL default '',
page varchar(20) NOT NULL default '',
url varchar(255) NOT NULL default '',
timestamp timestamp(14) NOT NULL,
UNIQUE KEY clickid (clickid)
) TYPE=MyISAM;

-------------------------------

Now at this point we have the backend ready to start logging your user clicks

lets move to browse.php which will perform this operation.

browse.php
---------------
<?
session_start();
$urlToBrowse=$_REQUEST['resource'];
$currentPage=$_REQUEST['page'];
$currentUser=$_SESSION['username'];
$currentTime=time();

$sHostName="localhost";
$sDatabaseName="put-your-database-name-here";
$sUserName="put-database-username-here";
$sPassword="put-password-for-that-username-here";

mysql_connect($sHostName,$sUserName,$sPassword) or die (mysql_error());
mysql_select_db($sDatabaseName) or die (mysql_error());

$sQuery="insert into clicks(username,page,url,timestamp) values ('$currentUser','$currentPage','$urlToBrowse','$currentTime') ";
mysql_query($sQuery) or die (mysql_error());

echo "<script language=javascript>location.href='$urlToBrowse'</script>";
exit;

?>

---------------


thats it, Got the point?

browse.php first takes populates values in all the variables that it needs to use in order to log the click

remember 'current page name' and 'url to browse' came from the previous page which called browse.php
username, we stored username in session variable
and current time stamp came from php function time();

then it did connect to the database and then stored the values and redirected the user to the desired location after logging

Booom!

user would successfully reach the desired location without knowing what we did ;)

Now comes the time for a php file which will give you reports of this logging, leme drink some water and you meanwhile play with this and i will post my next message
shortly (this time, in time) ;)

Leme know if this helps or you need any clearification.

I appologize once again.

Thank You very much,

Kami

P:S, all the code i wrote in is Logically corrent, there may be any any syntax error because i didnt run it, but leme know if it gives any error.

kentuckyslone

3:39 pm on Jul 25, 2005 (gmt 0)

10+ Year Member



Hi Kami,

There is no need for apologies. I appreciate all that you have done and I am sorry that you have had some bad times lately.

I will get to work on implementing this and will get back to you soon.

David

kentuckyslone

5:11 pm on Jul 25, 2005 (gmt 0)

10+ Year Member



OK I set all of this up and didnt get any errors. I created a test account for myself and clicked a link that I had set up to your specs.

I have a question though. This will tell me who has clicked on the links but how will I know which of those who clicked a link has actually went on to complete an offer so that I will be able credit their account?

Example: I am using an affiliate program that has many different offers for which I will be paid when a member completes one of them. The affiliate program allows me to add a sub ID after the url

the normal link is
<a
href="http://www.dpbolvw.net/click-1726522-10292442</a>

with sub ID added it becomes
<a
href="http://www.dpbolvw.net/click-1726522-10292442&sid=43</a>

When I log into my affiliate account to check sign ups there will be sub ID's listed after those that were succesful. So in this case I would see SUB ID 43. Which will let me know that the member with that sub ID has completed the "offer" and I will know that I need to credit that member for their action

Is there anyway that this method can be used to actually add the users ID # to the end of the url?

David

Anyango

7:26 pm on Jul 25, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hey

Although adding an id to that url will be simple, we can assign each of your members an id and store it in a table and whenever browsing any affiliate program, we can pass that id in the url, but it will be a bit tricky if, if your different affiliate programs need you to have different ids for a user.

for example

for username "David"

if

[afiliateprogram1.com?affiliateid=30...]

and other is

[afiliateprogram2.com?affiliateid=20...]

Then it will become tricky to manage many to many relation between ids and users. Otherwise if you can assign one single affiliate id to each of your members and for all affiliate programs if you use the same id for that very user, for example

"David" gets an id of 1

now if for your 10 affiliate programs you can send affiliate id 1 for "David", thats cool then

There will definitely be a table which contains usernames and their profiles, add a new field in there "affiliateid", now assign each of your members an id as you like,

now again when your script checks for login and at the point where you stored value of username in session, pick value of id from database for that user and save it in another session variable.

now in the new table that you created for clicks

add the same field "affiliateid"

and your new browse.php now looks like this

browse.php
---------------
<?
session_start();
$urlToBrowse=$_REQUEST['resource'];
$currentPage=$_REQUEST['page'];
$currentUser=$_SESSION['username'];
$affiliateID=$_SESSION['affiliateid'];
$currentTime=time();

$sHostName="localhost";
$sDatabaseName="put-your-database-name-here";
$sUserName="put-database-username-here";
$sPassword="put-password-for-that-username-here";

mysql_connect($sHostName,$sUserName,$sPassword) or die (mysql_error());
mysql_select_db($sDatabaseName) or die (mysql_error());

$sQuery="insert into clicks(username,page,url,timestamp,affiliateid) values ('$currentUser','$currentPage','$urlToBrowse','$currentTime','$affiliateID') ";
mysql_query($sQuery) or die (mysql_error());

$urlToBrowse=$urlToBrowse."&sid=".$affiliateID;

echo "<script language=javascript>location.href='$urlToBrowse'</script>";
exit;

?>

---------------

this will take that id, store in your click log table along with other fields, append sid at the end of url and send

;)

Anyango

7:35 pm on Jul 25, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



or or or To make things really simple , you can do this

without needing to change any thing any file any database table you can do this by just edditing your browse.php like this

if you can send any sid value as you like so why not lets do this


<?
session_start();
$urlToBrowse=$_REQUEST['resource'];
$currentPage=$_REQUEST['page'];
$currentUser=$_SESSION['username'];
$currentTime=time();

$sHostName="localhost";
$sDatabaseName="put-your-database-name-here";
$sUserName="put-database-username-here";
$sPassword="put-password-for-that-username-here";

mysql_connect($sHostName,$sUserName,$sPassword) or die (mysql_error());
mysql_select_db($sDatabaseName) or die (mysql_error());

$sQuery="insert into clicks(username,page,url,timestamp) values ('$currentUser','$currentPage','$urlToBrowse','$currentTime') ";
mysql_query($sQuery) or die (mysql_error());

$sQuery="select max(clickid) as sid from clicks";
$sResult=mysql_query($sQuery) or die (mysql_error());
$sRecordCount=mysql_num_rows($sResult);
$sRecordSet=mysql_fetch_assoc($sResult);
$sid=$sRecordSet['sid'];

$urlToBrowse=$urlToBrowse."&sid=".$sid;

echo "<script language=javascript>location.href='$urlToBrowse'</script>";
exit;

?>

---------------

Now leme explain what this will do,

as you know our clicks table autogenerates a "clickid" for each of the record we enter, now when browse.php will be called it will as before

store the same values as originial browse.php did but this one, after stroring the values, retrieves the maximum value of clickid in the table, and that maximum value is id of the latest record we entered, now you can send that id to your affiliate program, now when your affiliate program tells you that your

sid=1423

completed a registration, you simply open clicks table and check username against clickid=1423 and that is the guy who did it.

Cool? ;)

Anyango

8:41 pm on Jul 25, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



And Congrats David, we have had so much discussion on this topic that your user type has now been increased to "Junior Member" from "New user"

;)

ajs83

8:56 pm on Jul 25, 2005 (gmt 0)

10+ Year Member



Something easier is to just query their login information and append their user id or whatever you want to track them by like

[affiliatesite.com...]

and when each one logs in, the links will be set.

This 35 message thread spans 2 pages: 35