How to put PHP tracking code on individual Wordpress Posts

by 8 replies
9
This PHP tracking code below is what I want to put on this ONE page on my site How Buy Silver Bullion

PHP Code:
<? 
    $referrer = urlencode($_SERVER['HTTP_REFERER']); 
    $referrer =  str_replace("http://","", $referrer);
    $referrer =  str_replace("https://","", $referrer);
    if(!$_GET['apflag']) header("Location: http://www.ourkangen.net/affiliateprophetscript/go.php?uid=1&cid=1&apflag=1&referrer=$referrer&".$_SERVER["QUERY_STRING"]);
    if(!$_COOKIE['apid']) setcookie("apid", $_GET['apid'], time()+300000000);
?>
I have no idea how to even do that but there must be a way. Please tell me what I need to do in order to successfully add that tracking code

Thanks!
#programming #code #php #put #tracking
  • I was getting a blank screen on the submission process when trying to post the above post.

    I guess I pressed "submit post" 3 times which is why this post appears 3 times in a row.
    • [1] reply
    • You can delete the others you know.

      Just click edit post and then delete.
      • [1] reply
  • there are wordpress plugins that allow you to insert PHP

    search on the wordpress plugin page for plugins with the name "php exec"
  • hi from where did you get this code ? i guess there might be some instructions on how to use this code.
    • [1] reply
    • I got this code from a product called Affiliate Prophet... apparently they have a bigger and better product called conversion prophet. Not sure what I'll do yet. I REALLY need serious eff'in tracking because playing in the dark is losing me money!
  • a couple of suggestions.

    move the code with the cookie one row up and move the header... redirect to the next line

    the line with the cookie you may need to enter ".yourdomain.com"
  • Hi Cosmolito,

    Is the affiliate link format still active or working?
    If so try to move the line, $referrer = urlencode($_SERVER['HTTP_REFERER']);
    after the last str_replace line.

    Edwin

Next Topics on Trending Feed