Webmaster Forum


Go Back   Webmaster Forum > Web Development > Coding Forum

Coding Forum Problems with your code? Discuss coding issues, including JavaScript, PHP & MySQL, HTML & CSS, Flash & ActionScript, and more.


Reply
 
LinkBack Thread Tools Display Modes
Share |
  #1 (permalink)  
Old 09-10-2011, 12:38 PM
Nirav Dave's Avatar
Contributing Member
Latest Blog:
None

 
Join Date: 01-06-11
Location: India
Posts: 147
iTrader: 0 / 0%
Question How can I use GA tracking to count my affiliate link php redirects??

Actually I want to know how to use GA tracking code to count how many times my affiliate links have been clicked...

I ma using wordpress site and php redirection...
my php redirection code is,
PHP Code:
 <?php
header
'Location: [url]http://myaffiliatelink.com');[/url]
?>
As we know analytics code would be,
HTML Code:
<script type=”text/javascript”> <--- code ---> </script>
If I place code before the php redirects, it gives an error like... " Cannot modify header information"
If I will put it after the redirection, tracking code will not be triggered....

I have search the web but as I am not any programmer, I can't get all those things because they are not giving clear points ans samples...
And to trigger the tracking, I need to give delay to redirect according to some articles....

Now what exactly I need to put in my php file ???
What exactly I need to put on links ?? (means simple html link or any javascript function)
If you suggest me javascript function or codes then please give me sample because I am not good with codes and programs...

Thank you vary much your help would be highly appreciated...
Nirav Dave
__________________
Love & Relationship Blog For Better Relationship Management....
How to make a guy fall in love with you

Get Pregnant Easily & Naturally
Pregnancy Miracle

Last edited by HTMLBasicTutor; 09-10-2011 at 01:43 PM.
 
Reply With Quote
  #2 (permalink)  
Old 09-11-2011, 07:53 PM
Rukbat's Avatar
Contributing Member
Latest Blog:
None

 
Join Date: 08-08-11
Location: Long Island, NY, USA
Posts: 287
iTrader: 0 / 0%
The PHP code is being executed on the server, before the Javascript gets sent to the browser. It can't work your way, no matter which order you put the lines in. The PHP still gets executed first and the rest of the HTML sent to the browser comes from http://www.myaffiliatelink.com/.

As far as the header problem, as soon as a PHP file sends anything to the browser, even a blank line, headers have been sent. (That's one of the nice things and one of the bad things about PHP - you don't have to write the headers, but you're not aware that they're being sent.) That includes your Javascript code. You need the script executed in the browser, then the redirect done by the browser. (A PHP redirect is done by the server.)

Have you tried the GA script, then a Javascript redirect, all within the <script></script> tags?
 
Reply With Quote
Go Back   Webmaster Forum > Web Development > Coding Forum

Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Sales/Business Development for affiliate tracking software TMM_Vlad Looking To Hire 0 12-13-2010 10:47 AM
FREE PPC Affiliate Tracking Software, Tracking202.com kazisdaman Affiliate Marketing Forum 8 08-25-2009 05:58 PM
Tracking affiliate traffic conversions gregdavidson Webmaster Revenue 1 03-20-2008 01:36 PM
Affiliate code hider / tracking script ?! screamfine Coding Forum 1 12-18-2006 12:32 PM


V7N Network
Get exposure! V7N I Love Photography V7N SEO Blog V7N Directory


All times are GMT -7. The time now is 04:50 AM.
Powered by vBulletin
Copyright © 2000-2013 Jelsoft Enterprises Limited.
Copyright © 2003 - 2013 Escalate Media LP




Search Engine Optimization by vBSEO 3.6.0 RC 2 ©2011, Crawlability, Inc.