Rattler58 Posted April 5, 2011 Share Posted April 5, 2011 Hello everyone. I have a small problem. I might receive a ?aff=## or not on the end of my url when I get a visitor to my website. This depends on if they are sent from a affiliate website or not. If they are it shows fine on the home page but I loss it if they go to another page on my website. I need to keep this ?aff=## information while they look at the other pages. How would I capture and pass this information to my other pages as they surf my site? I tried this to no avail. $aff=$_GET['aff']; I have no clue no adding it back to the next page they go to. Any ideas would be helpful.. Link to comment https://forums.phpfreaks.com/topic/232769-url-query-string-tracking/ Share on other sites More sharing options...
Julius Posted April 5, 2011 Share Posted April 5, 2011 just attach it to link. example: <a href="yourfile.php?aff=$aff">MyFile</a> is that what you want? Link to comment https://forums.phpfreaks.com/topic/232769-url-query-string-tracking/#findComment-1197294 Share on other sites More sharing options...
kanikilu Posted April 5, 2011 Share Posted April 5, 2011 It's been a while since I've needed to use sessions, but I think they may be one way to go about accomplishing this. http://us.php.net/manual/en/function.session-start.php Something like: session_start(); $_SESSION['aff'] = ($_GET['aff'] ? $_GET['aff'] : FALSE); Now you can check for that session variable on each page and keep track of it, without having to append a query string to every URL. Link to comment https://forums.phpfreaks.com/topic/232769-url-query-string-tracking/#findComment-1197319 Share on other sites More sharing options...
Rattler58 Posted April 5, 2011 Author Share Posted April 5, 2011 Well I tried your examples and I'm not seeing any change. Nothing is added to the url. I am at a loss. I added the session example above the <!doctype and added some code to try and echo the $_session['aff'] as well as the $get['aff'] if i add them inside <?php it echos $_session['aff']; $get['aff']; at me not the value of aff. if i just add the echo comand to my html its blank. Link to comment https://forums.phpfreaks.com/topic/232769-url-query-string-tracking/#findComment-1197434 Share on other sites More sharing options...
Rattler58 Posted April 5, 2011 Author Share Posted April 5, 2011 This is a snippet of were I placed the code. When i try to <?php echo $aff; ?> it is blank. <!--Page Preamble--> <!--Master Page Preamble--> <?php session_start(); $_SESSION['aff'] = ($_GET['aff'] ? $_GET['aff'] : FALSE); ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <meta name="Generator" content="Serif WebPlus X4 (12.0.4.031)"> <title>Credit-Score-Improvement.com</title> <meta name="keywords" content="credit,score,repair,report,bad credit,no credit,credit score,credit report,improve credit,fix credit,improve my credit,credit help"> <meta name="description" content="Improve your credit score. Get an interest free loan with no credit check. Bad credit or No credit it doesn't matter we guarantee you the loan. Sign up now. Get your credit back on track."> <link rel="icon" href="favicon.ico" type="image/x-icon"> <link rel="shortcut icon" href="favicon.ico" type="image/x-icon"> <script type="text/javascript"> var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-16477199-2']); _gaq.push(['_trackPageview']); (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); </script><!--Page Head--><?php $aff=$_GET['aff']; ?> <!--Master Page Head--> Link to comment https://forums.phpfreaks.com/topic/232769-url-query-string-tracking/#findComment-1197464 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.