Home >
Technical & Creative Skills >
Programming, Servers & Scripts
Can anyone help with a PHP script - if that's what I need? (8)
03-07-2017 08:56 AM
#1
stereomike (Member)
Can anyone help with a PHP script - if that's what I need?
Hey guys!
I have a Wordpress website that has outbound affiliate links. I wish to serve different affiliate tracking links depending to the user that is determined by how they have entered the site.
For example, if the user comes to the site via this link www.website.com?utm_source=facebook then I wish to serve them www.affiliatelink.com?tracking=fb. If they came via www.website.com?utm_source=google then I wish to show them www.affiliatelink.com?tracking=google.
I hope there is a plugin available, but I cannot find one. Otherwise I'm thinking I'll need a php script and store all the information in a database? Any help is much appreciated!
Thanks
Mike
03-07-2017 09:38 AM
#2
matuloo (Legendary Moderator)
Not sure if there is a plugin for this, but it is definitely doable with some custom coding, you need to create a "session" (or something like that) for the surfer and carry the ref info with them throughout the site so it's available even after a deep surfing session. I asked my coder about it, he says it's doable with javascript too (plus other options), but the final solution depends on whether you want to handle this on a "per visit" basis, or store the info for future use in case of a return visit ... one way or another, it's not a very complicated task and any decent coder should be able to make this for you.
03-07-2017 09:42 AM
#3
iAmAttila (Veteran Member)
What you want done is HTTP HEADERS remapping. Our coder had this done for us, we basically had to append a custom code for every link we wanted to pass the HTTP HEADER info from incoming link.
03-07-2017 09:54 AM
#4
diplomat (Member)
Well, you can easily write a shortcode for Wordpress and have it like this:
Code:
function addSource($a)
{
return htmlspecialchars($_GET['utm_source']);
}
add_shortcode('source', 'addSource');
And use like this:
Code:
<a href="http://myaffiliatelink.com/?tracking=[source]">Earn me some money</a>
So when someone visits:
http://scetchyaffsite.com/dr-oz-fansite/?utm_source=fb
Your link will look like:
Code:
<a href="http://myaffiliatelink.com/?tracking=fb">Earn me some money</a>
But you can always set up sessions use those sessions so you can have those links site wide. Super easy stuff
03-07-2017 01:18 PM
#5
stereomike (Member)
Thanks for all the quick replies guys!
@diplomat - when you say set up sessions... is this something that can be done with a plugin?
I can see now that if I can store the source in the URL string then I can use Voluum or something to serve the correct landing page based on the referring URL?
Otherwise - I think I'm gonna need a coder. Do you guys know a sensible place to start looking for one?
thanks again!!
03-07-2017 01:44 PM
#6
matuloo (Legendary Moderator)

Originally Posted by
stereomike
Thanks for all the quick replies guys!
@diplomat - when you say set up sessions... is this something that can be done with a plugin?
I can see now that if I can store the source in the URL string then I can use
Voluum or something to serve the correct landing page based on the referring URL?
Otherwise - I think I'm gonna need a coder. Do you guys know a sensible place to start looking for one?
thanks again!!
I'm afraid you will need a coder, if this was a simple LP or a mini site, you could probably handle it as a multi-step lander. But since we are talking about a full wordpress site with (probably) multiple links to various offers .. you will need custom coding.
Which brings me to another question : do you also plan to somehow track what source made how much revenue ... or even down to banner/creative level used at particular sources?
03-07-2017 01:46 PM
#7
diplomat (Member)

Originally Posted by
stereomike
Thanks for all the quick replies guys!
@diplomat - when you say set up sessions... is this something that can be done with a plugin?
I can see now that if I can store the source in the URL string then I can use
Voluum or something to serve the correct landing page based on the referring URL?
Otherwise - I think I'm gonna need a coder. Do you guys know a sensible place to start looking for one?
thanks again!!
You probably need someone to write a plugin for you. If you have no programming experience with Wordpress then it may be a bit too difficult task.
03-07-2017 01:50 PM
#8
stereomike (Member)

Originally Posted by
matuloo
I'm afraid you will need a coder, if this was a simple LP or a mini site, you could probably handle it as a multi-step lander. But since we are talking about a full wordpress site with (probably) multiple links to various offers .. you will need custom coding.
Which brings me to another question : do you also plan to somehow track what source made how much revenue ... or even down to banner/creative level used at particular sources?
Yes, I think I will need a coder. If I try anything myself it'll no doubt go wrong in the long-run!
To answer your question - each source will have it's own set of offer links. So, let's say there are 3 brands in total, I'll have 3 offer links that are only used for Adwords.
I'm essentially looking for the benefits of having a different site for each traffic source - without the obviously problem of doing that!
Home >
Technical & Creative Skills >
Programming, Servers & Scripts