Google analytics and PHP redirection pages

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Smart Fred
    Confirmed User
    • Mar 2008
    • 308

    #1

    Google analytics and PHP redirection pages

    Hi guys,

    From a few months I started using redirection pages to manage from one place my affiliation code I use on many galleries.

    So I use such a code
    <?php
    $agent = $_SERVER['HTTP_USER_AGENT'];
    if (preg_match('/(iPod|iPhone|android|blackBerry|symbianOS|opera mini|windows CE|nokia|sonyericsson|webOS|palmOS)/i', $agent)) {
    header("location: http://my-affiliation-link-to-mobile-tour");
    } else {
    header("location: http://my-affiliation-link-to-classic-tour");
    }
    ?>
    in an index.php file in such a directory http://my-domain.com/go/program/

    But I feel completely unable to get Google analytics stats for such a page.
    So I'm unable to compare the amount I sent with the amount received on the affiliation program, and I'm also unable to define this page as a goal in Google Analytics.

    Is there anyway to use Google Analytics stats and goals for such redirection pages ?

    Thanks for your help.
    Stop doing what you like and start doing what brings you money!
  • robber
    Web Developer
    • Jan 2011
    • 264

    #2
    Hi,

    You need to go about tracking the link in a different way, it needs to be on the page of your site it's being clicked on instead, as the php redirect will not trigger the code as it executes pretty much instantaneously.

    Take a look at the google article on how to work with analytics to track the outbound links

    https://support.google.com/analytics...36920?hl=en-GB

    Hope this helps

    Rob

    Comment

    • Smart Fred
      Confirmed User
      • Mar 2008
      • 308

      #3
      Thanks Rob,
      That should be what I need. I will try implement the outbound links on my site asap.
      Stop doing what you like and start doing what brings you money!

      Comment

      • fappingJack
        So Fucking Banned
        • Dec 2014
        • 2172

        #4

        Comment

        Working...