Using .PHP to Make Google (and Your Users) Happy

Google SlapGoogle hates paid links. It is rumored that Google has started penalizing links that go through affiliate links on the first hop.

For example, sites that have Clickbank links have seen their ranking drop. Testing shows that when the links are masked ranking returns.

In addition studies have revealed that “bare” affiliate links can result in lower ctr. Links that obviously go off-site tend to get lower ctr than links that go to another page within the same domain.

So what can the affiliate marketer do about this?

The below PHP code may be an answer. It is code that allows masking of your links while still passing across the variables.

For example:

http://www.YOURWEBSITE.com/redirect.php?merchantID=XXXX&userID=YOURUSERID&productID=123456789

Would redirect to:

http://www.REDIRECTWEBSITE.com/m-pr.cfm?merchantID=XXXX&userID=YOURUSERID&productID=123456789

Here’s the Code:

Option #1: Using HTML META tag refresh:


<?php
  // destination URL
  $destination = 'http://destination-domain.com/destination.php';
  // redirect after 5 seconds
  $redirect_time = 5;

  // iterate through URL's variables
  $count = count($_GET) - 1;
  $get_values = '?';
  foreach($_GET as $key => $val) {
    $get_values .= $key . '=' . $val;
      if ($count > 0) {
        $get_values .= '&';
      }
      $count--;
  }

  // print META tag to refresh
  echo '<meta http-equiv="Refresh" content="' . $redirect_time . '; URL=' . $destination . $get_values . '">';
  echo '<p>Redirecting in ' . $redirect_time . ' seconds...</p>';
?>

Option #2: Using PHP header:


<?php
  // destination URL
  $destination = 'http://destination-domain.com/destination.php';
  // get URI request
  $uri = $_SERVER['REQUEST_URI'];
	
  // split URL and GET parameters
  $get = preg_split("/\?/", $uri);

  // sends a raw HTTP header to redirect
  header("HTTP/1.1 301 Moved Permanently");
  header('Location: ' . $destination . '?' . $get[1]);
?>

Please bear in mind that masked links or not, if the landing page you are linking to offers the user what Google considers a very poor-quality experience and/or if the site is found to violate Google’s unacceptable business practice or inaccurate or misleading claims policy, then you could get slapped or even banned from using AdWords!

Google may demand that until acceptable changes are made to the website you linked to they will not grant a review. That you have no way of affecting any changes to said website is irrelevant to Google. In Google’s eyes you are responsible for the offending site!

Final word of warning: if you are driving traffic to a site that may be a bit questionable, the onus is on you to make sure they are on the up and up – cause you are the one who is going to get slapped.

3 Comments on “Using .PHP to Make Google (and Your Users) Happy”

Leave a Reply

Your email address will not be published. Required fields are marked *