Jump to content

URL query string tracking.


Rattler58

Recommended Posts

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
Share on other sites

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
Share on other sites

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
Share on other sites

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&#39;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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.