Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I am setting up my wp site and i have it setup like this www.mydomain.com/?ref=AFFILIATEID thats alright if they land on the page they are directed to but if they go off page onto another one, how do i get the affiliate id to track through the site so that anywhere i put the link www.affiliatelink.com/ it will show who the referer is.

Also is there a way to set a default referer so that if someone came to the site www.mydomain.com it would have a defulat affiliate id set through out the site.

Im using the latest wordpress, self hosted and using the optimizepress theme

Thanks

James

share|improve this question
    
James, great to have you at WPSE! Have you tried anything yet code-wise for this? –  Brian Fegter Aug 23 '12 at 0:17
    
Hi Brian nope i havent, im not a coder, i can edit files and usually get scripts to do as i need lol. I did look into plugins but none of them are doing what i want, or add too much to the site, so editing files and or url would be the next way for me to go. James –  James Reilly Aug 23 '12 at 15:54

1 Answer 1

Try using add_query_arg().

For example, if your query key is "ref", and your query key value is "AFFILIATEID":

<?php add_query_arg( 'ref', 'AFFILIATEID' ); ?>

If you need to retrieve your query arg value, use get_query_var():

<?php get_query_var( 'ref' ); ?>
share|improve this answer
    
I tried the code and it didnt work, im using the plugin Exec-PHP so that i can use php code on the site, would it be that plugin, is there a better or recommended one to use? Ive got this on the site <?php echo $_GET['ref']; ?> this is in the aweber code so i can adtrack it, i can use the adtrack in the aweber email to direct but i cant get the above code to show the ref it just shows the code as thought it were not php code??? –  James Reilly Aug 23 '12 at 20:53
1  
The question is simply not answerable with any greater precision, because you've not posted relevant code. –  Chip Bennett Aug 23 '12 at 21:02

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.