Christmas Greetings fellow affiliates and affiliate fans. I remembered about a little bit of code I formerly used quite frequently to let me dynamically add data on which keywords were converting to sale when using a single landing page for a broad keyword set.
Php Echos in a Nutshell…
Are an incredibly easy and quick to use way to pass a variable (such as a search term) into any part of a webpage you desire. You can use it to pass data from your url directly into your affiliate link or to make your landing page look instantly relevant to the keyword your visitor searched on.
Clear As Mud? Don’t Worry, Here’s a Quick Guide!
1. Getting Your Landing Page Ready
It’s very simple to get your landing page ready to work alongside the php code. Just develop your page as normal and when you’re finished save it with a .php file extension.
2. Inserting Your Code
This is a straightforward cut and paste job. Our small but perfectly formed insertion is the piece of code below:-
<?php echo $_GET['ref'];?>
All you have to do is paste that wherever you want to be able to dynamically change your page content. For example, in an affiliate url thusly: -
http://clkuk.tradedoubler.com/click?p=0000&a=000000&g=000000&epi=<?php echo $_GET['ref'];?>
You can also put it in something like a page header element, or in anchor text.
3. Passing The Variable To Your Page
Sounds like the hard bit, but really it isn’t! All you have to do is add a little bit onto your landing page URL and then stick in whatever data you want to be placed on the page. Essentially, it enables you to create a unique URL for as many variables as you like whilst only using a single landing page.
Just add the code below to the end of your url:-
?&ref=
This creates a URL that looks something like this: -
http://www.yourlandingpage.com/index.php?&ref=Whatever The Hell You Want
You can see this in action at an old landing page of mine which still miraculously generates the odd commission for me, despite having been abandoned for 2 years: -
http://www.cheapdvdrentals.co.uk/index.php?&ref=HELLO AFFILIATE STUFF FANS
If you hover over any of the “Visit Site” links, you’ll see my affiliate links have whatever is added to the URL after “&ref=”
Use this in combination with my recent thoughts on concatenation, and you’ll be able to create a fully tracked PPC campaign in no time!
NB – There is a way to pass this variable through “cloaked” affiliate links, I found the code on my hard drive earler… it’s just something I never ended up using as I changed the way my business operated. If anyone wants to add this to the post, please do leave a comment.
Got A Handy Tip You Want To Share?
If you have a time saving tip of any sort related to the wonderful world of computers which you’d like to share, please contact me. I’ll gladly give anyone who sends something useful in a lovely backlink from the blog to say thanks!
Related Affiliate Marketing Posts

December 3rd, 2008 at 12:58 pm
thanks for the great tip. i also use the php code to hide the nasty long codes you get with some partners. thanks again james
December 3rd, 2008 at 1:49 pm
Hi Kirsty,
Great post – do you have any tips on how to track the keywords but not to pass the info onto the merchant?
Also if you could give the info on doing it through the cloaked links that would be great.
December 3rd, 2008 at 2:15 pm
Of course, you want to be careful of letting people do dodgy things like the following (if your comment form will allow me):
http://www.cheapdvdrentals.co.uk/index.php?&ref=<h1><a href="http://www.geniosity.co.za/musings/">james is genius</a></h1>
December 3rd, 2008 at 2:16 pm
Ok, actually, it was supposed to look like this (I think):
http://www.cheapdvdrentals.co.uk/index.php?&ref=james is genius
December 3rd, 2008 at 2:58 pm
You do open yourself up to XSS cross site scripting attacks using this techique unless you are careful.
http://www.cheapdvdrentals.co.uk/index.php?&ref=%27%3Cscript%3Ealert(%22boo%22);%3C/script%3Eoh%20dear%20whats%20this
or grab some page rank from teh page
http://www.cheapdvdrentals.co.uk/index.php?&ref=%27%3Ca%20href=%27http://www.mysite.com%27%3Enice%20inbound%20link%3C/a%3E%20oh%20dear%20whats%20this
(see how those links come uot as tehy have been escaped by the comment system)
December 4th, 2008 at 7:01 am
Hey Kirsty,
Great advice.
You keep saying that you used to use this and you used to use that.
Does this mean you no longer really do any ppc?
Marc
December 4th, 2008 at 7:07 am
@ Everyone who exposed various loopholes and internet trickery… LOL, I was expecting something like that to crop up. As I’ve said many times, I am not a programmer. Interesting trick re: the page rank mind you. TBH I’ve rarely used this on SEO sites, only landing pages.
@Darrell – This isn’t something I do (hiding data from the merchant). It is something I should think about, so I’ll look into it
@ Marc – Still into PPC heavily, I just run my landing pages a little differently now!!
December 4th, 2008 at 7:57 am
Thanks for the quick response Kirsty.
I am still trying to get a consistent profitable campaign from ppc.
If you dont mind me asking, I keep being told that adwords is next to impossible (although I likke working with it) to make money as a result of all the rules and high cpc costs.
I keep hearing go only to yahoo and only use the content network etc. Are these rumours truthful or have you found you can make profitable campaigns on google search?
Sorry for the long question, and thanks again
Marc
December 4th, 2008 at 8:06 am
Ho Marc, no problem… you’ve just caught me unwinding at the end of the day so it is a good time to get an answer, lol.
Adwords is very difficult if you are trying to make money from a landing page. It takes a lot of time and effort to create something that’ll still make money and comply with their rules.
I make a lot of my income from Adwords campaigns. I just think of all the people saying it can’t be done as really meaning “I can’t do it”. Not the same thing!
Have you thought of trying some really targeted direct to merchant PPC? Contrary to popular myth, this is perfectly OK with Google.
December 4th, 2008 at 11:50 am
Hey Kirsty,
I do have 1 campaign going on adwords (with a mini site I built using wordpress) that is currently profitable – but I suspect xmas conversions has something to do with this.
I do like direct to merchant campaigns, its just finding the right merchants who currently do not have anyone bidding on those terms where I have the problem. I found one the other day, but some else was bidding on most of the terms I was trying already….
Thanks Kirsty…time to keep plugging away.
December 4th, 2008 at 4:57 pm
“I found one the other day, but some else was bidding on most of the terms I was trying already….”
In this case doesnt google rotate the ads so you’d still show up some of the time?
December 5th, 2008 at 6:24 am
hey Russel,
I dont know to be honest. I know when I did try something google said (nxt to the kw in adwords) that the kw was inactive as another advertiser was bidding on it.
December 5th, 2008 at 7:35 am
Hey Marc / Russell… In my experience you will generally always get at least some traffic even when it looks as if another affiliate or the merchant have a search term in the bag. I’ve got some keywords that I can’t for the life of me get my ads to show up for… and yet I get a healthy amount of traffic for them each and every month.
Another thing you can do is really go to town on keyword variations around the search term you see competitors on. Even with terms Google says there’s no volume for you can quite often get a really nice little stream of traffic going for. Specially during the festive season.
Keep at it Marc!
December 5th, 2008 at 11:08 am
So if I were to bid HIGH would google let me ‘push’ that other person out?
December 5th, 2008 at 11:41 am
Theoretically, however I’d pursue that kind of strategy with caution. A lot of the time you might be up against a PPC agency or large affiliate with an extremely strong Adwords account QS. In that scenario you might have to pay a whole lot more than you’d like to get your ad up and running.
Personally, I prefer a nice, low margin campaign and cover all the less obvious bases. The result is quite often extremely healthy margins.
December 5th, 2008 at 12:21 pm
Cool, thanks Kirsty!