1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Trouble setting up php tracking across several pages

Discussion in 'General Programming Chat' started by dnsg12, Apr 30, 2009.

  1. dnsg12

    dnsg12 Newbie

    Joined:
    Mar 13, 2008
    Messages:
    2
    Likes Received:
    0
    I need help adding php tracking from Adwords to index.php to page 1 to page 2 to page 3.

    I want to generate an outbound affiliate link with keyword tracked from Adwords to the affiliate program "subid=". The outbound link is generated in an iframe, which what may be causing my problem.

    Here is what is being generated in the page source:

    Code:
    <iframe src="hxxp://affiliateprogram.com/&subid1=<?php echo $_GET['kw'] ;?>" frameborder="0"></iframe>
    
    For some reason my <?php echo $_GET['kw'] ;?> isn't converting to kw which is my keyword that is being tracked.

    Here is the code from the php file that generates the above link:

    <iframe src="<? echo "$url"; ?>" frameborder="0"></iframe>

    The $url is generated at the top of the page as: $url=$row["url"];

    I don't know a lot of php but I've tried session tracking and everything else I can find on the net, but I might not have been doing it right.

    Here is what is currently on my landing page (index.php)

    session_start();
    if(isset($_GET['kw']))
    $_SESSION['tracking'] = $_GET['kw'];

    I don't know if I've provided enough information, but does anyone know how to solve my problem?

    I've also tried adding the kw to the $url=$row["url"], but probably wrong. I tried something like:

    $url=$row["url" + "<?php echo $_GET['kw'] ;?>"]

    but it generated errors on page load.

    Anyone have any ideas?

    Thanks,
     
  2. 00CivicEX

    00CivicEX Jr. VIP Jr. VIP Premium Member

    Joined:
    Mar 3, 2009
    Messages:
    293
    Likes Received:
    214
    Try this,
    This Goes on your landing page, where it says keyword at the end put a basic keyword that way if someone comes from a direct link.
    Code:
    <?php
    if (is_null($kw = $_GET['KW'])) $kw='keyword';
     
    ?>
    
    If you send people straight your your affiliate link use this code

    Code:
    <a href="http://youraffiliate/abc123?subid=<?php echo $kw ?> 'GOOGLE'
    If you use jump pages, use this as link

    Code:
    <a href="http://www.yourwebsite.com/jump.php?kw=<?php echo $kw ?> 'GOOGLE'
    and put this on your jump page(s)

    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
    <meta content="text/html; charset=ISO-8859-1"
    http-equiv="content-type">
    <meta http-equiv="Refresh" content="0; URL=http://http://youraffiliate/abc123?subid=<?php echo $kw ?>">
    <title>Your Website Name</title>
    

    make sure you save it as .php and not .html,Let me know if this helps.
     
    Last edited: Apr 30, 2009
  3. 00CivicEX

    00CivicEX Jr. VIP Jr. VIP Premium Member

    Joined:
    Mar 3, 2009
    Messages:
    293
    Likes Received:
    214
    by the way if you cant get it workin hit me up in pm for my MSN and I can take a look at the code
     
  4. dnsg12

    dnsg12 Newbie

    Joined:
    Mar 13, 2008
    Messages:
    2
    Likes Received:
    0
    I got it working, thanks. I ended up using a completely different path. I ended up just GETting and ECHOing on the next page link all the way through the 6 or so pages.

    Probably not the best way, but it's working for now.