1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

how to do tracking for adwords for a page with header("Location: $url");?

Discussion in 'Google AdWords' started by john269, Jul 26, 2007.

  1. #1
    Hi,

    I have a landing page on my site where I am sending adwords visitors to. They read the information and then click on the link that looks something like: http://domainname.com/click.php?id=232

    When that is click it goes to a page with this script:

    $url = "http://domainname.com/affiliatesite.php";
    header("Location: $url");

    Now how can I do it so that I can track how many people click from the landing page, onto the link so that they end up at the affiliate site. I only want to track the Adwords clicks and not any other clicks that were referred by other websites or a visitor that was browsing the site and ended up there.

    Thanks!
     
    john269, Jul 26, 2007 IP
  2. lkj

    lkj Peon

    Messages:
    729
    Likes Received:
    17
    Best Answers:
    0
    Trophy Points:
    0
    #2
    You need to write a script that logs all the clicks (writes) to the txt file or mysql database. Or if you do with a simple redirect you can easily read it from the access_log
     
    lkj, Jul 26, 2007 IP
    john269 likes this.
  3. on-on

    on-on Peon

    Messages:
    95
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #3
    The simplest way while still doing it intelligently would be to do the following. If you're not already tracking by incoming source, make your destination url in AdWords include a parameter like ppcn=aw. So, it might look like http://domainname.com/click.php?id=232&ppcn=aw. This tells your script that the person came from AdWords. Might as well add keyword too if you want real metrics, so stick &kw={keyword} on the end.

    Create a table in mySQL with an auto-increment (int) primary key, a datetime field (with default of getdate() or now(), whichever it is), an (int) oid field to record your offer "id" from the querystring, a (varchar) keyword field to record the keyword and a (var) ppc_network field to keep track of what network it came from. Use PHP to check and grab all these $_GET variables from the incoming querystring and write them to the table, then pass the user on using your standard header redirect that you've already denoted. If you've got an affiliate network that accepts a "subid" field, stick the auto-incremented primary key (id) from this insertion into that field (like sub=187235 or whatever your network uses).

    Now you've got, in your database, what network they came from, what date and time it was, what keyword caused the click/conversion and you use the id to redirect, so you know which offer it is. You've also, if your affiliate network uses subids, got a foreign key in their database that matches the transaction. Once all your transactions clear on the affiliate network end, you download the subid report, tie them back together and figure out exactly which keywords make exactly how much money, etc, etc.

    Basically, capture all the data you can even if you can't use it yet. I wrote something about this in a recent blog entry on the topic. Sounds like you're a bit ahead of the average guerilla online marketer on the concept in general, but it's probably worth mentioning.

    Blog entry here: The confusion over cloaking and tracking redirection
     
    on-on, Jul 26, 2007 IP
    john269 likes this.
  4. john269

    john269 Notable Member

    Messages:
    6,229
    Likes Received:
    116
    Best Answers:
    0
    Trophy Points:
    235
    #4
    I have given you both rep for giving me ideas. on-on is the main post I got most of the ideas from though, but it's still nice that you replied, which helped me out in alot.

    I have been programming/coding for around 5 years so I know exactly how to do it now from here on. Thanks!


    The problem that I have now is that I will also be having Adsense ads on these landing pages so that it can slightly cheaper my CPC adwords costs. This seems to be alright with the Adsense and Adwords rules as long as it doesn't look like an MFA page or Arbitrage.

    But as I will be producing a load of different URL's as they will all go to the same destination, but will have different variables, will this mean that ever url will have to be visited by the Adsense robot so that it nows what ads to deliver to the end user. If this is the case then there could be thousands and I may not earn my full potential on the adsense ads because of the showing of the low paying or PSA's on the first few pageviews of every different url or am I starting to worry about nothing. lol
     
    john269, Jul 26, 2007 IP
  5. on-on

    on-on Peon

    Messages:
    95
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Glad if I could help! It's definitely nice to run across someone who understands programming and therefore the implications of this kind of simple little tracking automation, because it's so liitle work to gather so much fascinating and important data.

    I actually mainly deal with the CPC end of the PPC networks, so AdWords is more my bread and butter. That having been said, if you use querystring variables instead of mod_rewrite urls, my guess is that they'll treat the QS vars as non-unique and see it as the same page - this, after all, is how AdWords treats the same circumstance. I can't give you a conclusive answer though.

    Sorry it took me a bit to reply, I didn't notice the thread bump. Best of luck and let me know if we can bounce any other ideas back and forth!
     
    on-on, Jul 27, 2007 IP