Using PHPBay is a great way to quickly create an eBay affiliate site. Unfortunately, that ease also means anyone can create a ton of ‘eBay’ sites and pages which, as you might suspect, Google frowns upon. Anything mass produced – you might as well assume Google will not like that.
For that reason ‘just a PHPBay’ site can be hit or miss in Google. But there are some code customizations you can do to avoid being quickly fingerprinted as having another thin affiliate site:
1. Change up the default template. You don’t need everything created by PHPBay to be a link. All link and no text? Change it so only the graphics are linked. Or maybe just the text. And change the default text while you’re at it.
2. Randomize the number of auction listings. Instead of 10 listings per page, as everyone has, use php to get a random number, say between 5 and 15, then use that variable to control how many listings are shown on a page. It size of the content and number of links will thus be different each time the Googlebot comes by.
Within your config.php file, do something like this:
# MAXIMUM ITEMS PER PAGE $randomnum = mt_rand (5,15); $config['paging_num'] = $randomnum;
3. Change the default image url used for seo links. PHPBay by default makes the urls for images to be your domains/images/e/number.jpg. That ‘/images/e/’ is called a footprint. Within your ebay.php file find this line:
var $image_replace = "images/e/";
and change it to something else, such as good keyword.
Then, in your .htaccess file change all references to ‘^images/e/’ to your new location.
4. Change the default item listing for seo links. PHP by default makes each product link ‘item-’ followed by the product name. That, again, is a footprint. Within config.php, under Basic Options, find this line:
$config['url_prefix'] = "item-";
and change it to some other word, such as keyword, followed by the hyphen.
Then, in your .htaccess file, change the references to ‘^item’ to your keyword.
5. Make use of built in customization via the settings in the script and in the code added to each page.
Here are the parameters for the page code:
parameter 1 – keyword/phrase
parameter 2 – number to display (this setting is overridden if Paging is turned on)
parameter 3 – category number
parameter 4 – exclusion words (each word to exclude is separated by a space)
parameter 5 – custom id (overrides the global custom id set in config.php)
parameter 6 – true or false to use columns format or not.
6. Use the phpbay api standalone instead of just the function command
Regular function command:
<?php
require_once(" link to ebay.php ");
phpBayAPI($pagekeyword, "", "", "", "", false);
?>
Using the api standalone:
<?php
require_once(" link to ebay.php ");
# phpBayAPI($pagekeyword, "", "", "", "", false);
?>
<?php
# create the class
$ebay = new ebay();
# load the config.php settings
$ebay->config();
# settings below will override global options set in config.php
$ebay->eb_exclude = ""; // exclusion words for search separated by space
$ebay->eb_siteId = 0; // set country to 0 for the us
$ebay->eb_sabfmts = 0; // 0 for all 1 for auction only 2 for buy it now is a purchase option
$ebay->sort_by_value = 4; // set sort order 0 is best match 1 is time ending soon 2 is time newly listed
3 is price low first 4 is price hight first 5 is price plus shipping lowest 6 is price plus shipping highest
$ebay->eb_saprclo = 50; // set mininum price of items
$ebay->eb_saprchi = 9999; // set maximum price of items
# call the main function
$ebay->listings("obama", "");
# display the results
echo $ebay->html;
?>
7. How to Create a Second Template to Display Results
This is not for using two different templates on the same page. Rather, if you want to use an alternative template instead of the template on a page:
A. Change the web page reference from ebay.php to a custom name:
require_once(”/home/xxx/public_html/xxx/phpbay/ebaycustom.php”);
B. Copy ebay.php to ebaycustom.php
C. Within ebaycustom.php change all references within function getTemplate() from /templates to /templatesnew
D. Copy your templates files to templatesnew, and then make whatever changes you desire to the alternate template.
8. Prevent Google from “seeing” your affiliate links.
I have had websites with numerous page 1 rankings in Google, only to see the pages with eBay listings generated by phpBay get heavy penalties while the non-phpBay pages remain highly ranked. At the same time, I have seen previously penalized pages be resurrected simply by removing the links to eBay.
While removing the eBay links defeats the purpose of being an eBay affiliate, although this technique can still be used to generate Adsense income, the obvious conclusion is a penalty because Google is repeatedly clicking through links and ending up at eBay.
Solution: Since the GoogleBots always respect the robots.txt file instructions, fix your links so they go through a subdirectory and then ban the GoogleBot from accessing that subdirectory.
There are 3 changes to make:
In config.php change the SEO url from
$config['url_prefix'] = “item-”;
to
$config['url_prefix'] = “ban/keyword-”;
(changing the default item- to keyword- is previously discussed)
Your .htaccess file will be changed so it reflects:
RewriteRule ^ban/keyword-
Then add these lines to your robots.txt file:
User-agent: *
Disallow: /ban/
You can confirm in webmaster tools that Google will not follow a link to the /ban/ subdirectory – even though that subdirectory physically does not exist.
HOWEVER, my testing using a link to a page in a banned subdirectory is showing that Google ignores the robots.txt instruction even though Google says it will obey. That page in a banned subdirectory is showing in Google search results.
9. Remove common footprints phpBay uses for links
phpBay adds a country code to the end of every link. If you just have US links, each link will end “_US.html”. This is an unnecessary fingerprint of the phpBay script.
To change this (and only do this if you are only sending traffic to one eBay country site) around line 450 of the ebay.php file is this code:
$this->link_url = $this->site_url . $this->url_prefix . $this->urlText($item['title']) . “_” . $this->item_id . “_” . $this->country . $this->eb_custom_cid . “.html”;
change it to:
$this->link_url = $this->site_url . $this->url_prefix . $this->urlText($item['title']) . “_” . $this->item_id . “_CUSTOM” . $this->eb_custom_cid . “.html”;
“CUSTOM” is whatever you want to use. This makes the ending of all links custom to your desires and not the same as tens of thousands of other phpBay sites.
In your .htaccess file change the references to
&country=$3
to
&country=US
10. Customize the No Results Found Statement
In the file forms/form.no.results.php you can customize what statement is returned when no eBay results are found. Or you can create a blank file to display nothing. Or you can include an Adsense ad.
The default language is: “No items matching your keywords were found.” – An easy search term to find phpBay sites and niches others are using.
11. Block Google from Seeing Images as Belonging to eBay
All the Googlebot has to do is follow your image urls to discover the images are really hosted on eBay. Hmmm. Just like above for the links to eBay products, we can use robots.txt to block the Google bots from following the image urls. (Like above, be warned that testing is showing that Google does not obey robots.txt even though it says it does.)
Since it will not hurt to do this and maybe block some Google insight into your eBay connection, do this:
In ebay.php find this variable near the top of the file:
var $image_replace
and make the full command as follows:
var $image_replace = “ban/keyword”;
In your .htaccess file make your image seo rewrite look like this:
RewriteRule ^ban/keyword/(.*)$
As above, make sure the /ban subdirectory is banned in robots.txt
12. Remove Image URL Footprints
Each eBay image ends in “_0.jpg”. This is tricky to change but can be done.
In ebay.php under the setup the RSS class section is this code:
# if mod_rewrite for images is enabled, rewrite the url
if ($this->mod_rewrite == “1″) {
$this->image = str_replace($this->image_find, $this->image_replace, $this->image);
}
Immediately after that code add the following code to add a custom text to the end of each image url. This way Google cannot look for _0.jpg at the end of an image url to find a footprint:
$footprint = “.jpg”;
$footprintreplace = “-xxx.jpg”;
$this->image = str_replace($footprint, $footprintreplace, $this->image);
“xxx” can be any text you want, such as a keyword.
Now, instead of this in your .htaccess code:
RewriteRule ^ban/keyword/(.*)$ http://thumbs.ebaystatic.com/pict/$1 [R,L]
You will want this:
RewriteRule ^ban/keyword/(.*)-xxx.(.*)$ http://thumbs.ebaystatic.com/pict/$1.$2 [R,L]
13. Prevent Google From Following Links Through the phpBay Script
If Google decides not to obey the robots.txt ban, the fallback position is to identify the Google bots and block them within the auction.php file from ever reaching the eBay listings.
By default this should already occur since the Google bot is not on the approved list of bots. (Make sure you are using the updated auction.php file that does user agent, referrer, and IP checks to try and ban bad bots and clicks from undesirable countries.)
But just to make sure, add this code within the top section of auction.php where a user agent check is being made:
if (preg_match(”/google/”,$current_user_agent)) {
$ua_approved = false;
}
This checks if the user agent has Google in it. If so, set this to be a banned bot. You can test this using the User Agent Switcher plugin for Firefox, which lets you fake your user agent so your website thinks you are a Google bot.
You can also ad Google IP addresses within the ban list to ban by IP. While this can ‘mostly’ be effective, just give up on the idea that you will get a list of all of Google’s IP addresses.
My belief is that Google has a set IP list, but also adds some other / random IP every so often, with a masked user agent, to try and catch cloakers.
14. Replace the Graveyard for Undesirable Clicks
By default if a bad bot or IP address is clicking a link to eBay, auction.php will instead show them a blank html page.
You can better. You could send someone clicking from China to an affiliate offer, Adsense page, or anywhere else. Or your home page.
To do that replace the html with this php redirect to the home page:
header(’Location: /’);
Some will say it is better coding to have the url fully listed instead of a backslash, such as hxxp://yahoo.com, but using a backslash seems to work for me – and works better if your auction.php file is being shared by various domains.
15. Don’t Use the Same Customizations
When doing the above customizing be sure not use the same custom keyword. For instance, use keyword 1 to begin product urls and keyword 2 to begin image urls.
16. Avoid Repetitive Use of eBay Product IDs
Each eBay product phpBay lists will show it’s product ID in the image url and product url. And also possibly elsewhere, if you decide to use it as an alt image tag.
I’ve decided to remove my alt image tags since I am not trying to get the eBay images indexed.
To prevent the image url from having the same text as the product url, make these changes to the image url so it is different:
- Add text immediately before the product ID. For example, in ebay.php use this for your introductory image text:
var $image_replace = “ban/keyword/extratext”;
We are adding ‘extratext’ here to what is listed above. “extratext” can be another keyword or random text. It’s purpose is to differentiate the beginning of the image url.
- After removing the image footprint discussed previously, add this to your ebay.php file:
$this->image = preg_replace(’/0/’, ‘Z’, $this->image, 1);
What this will do is replace the first zero in the image product url to the letter Z. This will make the image urls different from the product urls, and randomly so since the first number zero in the product IDs occurs in different places. For now, it is always somewhere, though, in eBay’s product code.
- Now you need to fix your htaccess so that you can still retrieve the proper image even though the url has changed on your website. Use this, which combines the customizations in this section:
RewriteRule ^ban/keyword/extratext([^Z]*)Z(.*)-custom.(.*) http://thumbs.ebaystatic.com/pict/$1\0$2 [N]
Test to make sure it works. This is really slick! Now you have completely unique image urls, and there is no repetitive use of eBay product IDs that match the link to the eBay product.
17. Eliminate eBay Product ID from Product Links
Just as we changed the product ID in the image url we can make a change to product url. Why? So every link does not have underscore 12 digit number underscore. Big surprise, the 12 digit ID is an eBay id.
To eliminate this footprint, in ebay.php file add custom text immediately before the product ID. Building off the example above where we eliminated the ending ‘_US’ footprint, we now have:
$this->link_url = $this->site_url . $this->url_prefix . $this->urlText($item['title']) . “_CUSTOM1″ . $this->item_id . “_CUSTOM2″ . $this->eb_custom_cid . “.html”;
and our .htaccess link code is now:
RewriteRule ^ban/keyword-(.*)_CUSTOM1(.*)_(.*)_(.*).html$ auction.php?title=$1&item=$2&country=US&ccid=$4
RewriteRule ^ban/keyword-(.*)_CUSTOM1(.*)_(.*).html$ auction.php?title=$1&item=$2&country=US
RewriteRule ^ban/keyword-(.*)_CUSTOM1(.*).html$ auction.php?title=$1&item=$2
So if our custom text is FF, instead of seeing _123456789012_ Google will now see a unique code of _FF123456789012_.
Since you can have your own unique custom text, with its own length, another footprint is eliminated.
18. Eliminate the Product Title from Product ID Link
In my sites I am not linking the product title to eBay. Just the product image and letting the product title simply be text.
I was looking at the auction.php file and saw that the product title does not appear to be passed to eBay.
(I also don’t see where it is being used by QCT, although the variable is passed to the script.)
Removing the item title from the link url in ebay.php, and associated change in .htaccess does not seem to have any negative impact.
I believe the item title in the link url is only there for the “SEO Urls” option.
But there are really two SEO issues here:
1. Showing a naked link to eBay versus a link that appears to be on my site. In other words, obfuscating that this is an affiliate site.
2. Using keywords in link urls. But there is no purpose in creating an SEO link to eBay because we do not want to promote eBay listings ahead of our listings of eBay listings. And since the link is to a nonexistent page on our site there is no page for Google to index. So there may be no SEO benefit except from having the keywords listed on the page twice, in addition to the listing for the product title.
Removing the item title from the link url does not affect SEO issue #1.
For issue #2 it depends on your SEO beliefs. Is there a benefit from having the product title mentioned twice (once in the link and one for the product title)? Or avoid repetition and a footprint by only having it once as the product title?
Here is how do to it:
New line in ebay.php, incorporating the above customizations:
$this->link_url = $this->site_url . $this->url_prefix . “_CUSTOM1″ . $this->item_id . “_CUSTOM2″ . $this->eb_custom_cid . “.html”;
Change the htaccess, so with all of the above it is this for the product links:
RewriteRule ^ban/keyword-(.*)_CUSTOM1(.*)_(.*)_(.*).html$ auction.php?item=$1&country=US&ccid=$3
RewriteRule ^ban/keyword-(.*)_CUSTOM1(.*)_(.*).html$ auction.php?item=$1&country=US
RewriteRule ^ban/keyword-(.*)_CUSTOM1(.*).html$ auction.php?item=$1
Conclusion: Wrapping up all of the above here are the phpbay script changes
(note: if copying from this page remember to fix your quotes and single quotes to normal keyboard characters)
config.php
$config['url_prefix'] = “ban/keyword1-”;
# MAXIMUM ITEMS PER PAGE
$randomnum = mt_rand (5,15);
$config['paging_num'] = $randomnum;
ebay.php
var $image_replace = “ban/keyword2/extratext”;
$this->link_url = $this->site_url . $this->url_prefix . “_CUSTOM1″ . $this->item_id . “_CUSTOM2″ . $this->eb_custom_cid . “.html”;
under the setup the RSS class section is this code:
# if mod_rewrite for images is enabled, rewrite the url
if ($this->mod_rewrite == “1″) {
$this->image = str_replace($this->image_find, $this->image_replace, $this->image);
}
Immediately after that code add the following code
$footprint = “.jpg”;
$footprintreplace = “-xxx.jpg”;
$this->image = str_replace($footprint, $footprintreplace, $this->image);
$this->image = preg_replace(’/0/’, ‘Z’, $this->image, 1);
.htaccess
RewriteRule ^ban/keyword2/extratext([^Z]*)Z(.*)-xxx.(.*) http://thumbs.ebaystatic.com/pict/$1\0$2 [N]
RewriteRule ^ban/keyword1-(.*)_CUSTOM1(.*)_(.*)_(.*).html$ auction.php?item=$1&country=US&ccid=$3
RewriteRule ^ban/keyword1-(.*)_CUSTOM1(.*)_(.*).html$ auction.php?item=$1&country=US
RewriteRule ^ban/keyword1-(.*)_CUSTOM1(.*).html$ auction.php?item=$1
template
- customize statement under forms when no results are found
- customize look of results that displayed
auction.php
Within the top section where a user agent check is being made:
if (preg_match(”/google/”,$current_user_agent)) {
$ua_approved = false;
}
replace the html with this php redirect to the home page:
header(’Location: /’);
robots.txt
User-agent: *
Disallow: /ban/
There you have it, easy ways to change your PHPBay footprint so you don’t automatically scream to Google – hey, eBay affiliate site here. There are already enough stories of how Google hates eBay affiliate sites without adding yours to the collection.
Related Post:
How to Hide your eBay affiliate links from Google
Update: This comes from the phpBay forum, but I wanted to include it because it is so useful (just in case something ever happened to that forum post). This is how to use Skimlinks with phpBay:
You can use SkimLinks with the current PhpBay version with just a little modification to your auction.php file.
1. Go to https://accounts.skimlinks.com/sites to get the Publisher ID of your website.
2. You need to use the SEO Urls feature for this to work.
3. Add the following code after the long line that starts with $url = “http://rover.ebay.com/rover/….” in auction.php (near line 279 at the end):
Code:
//SkimLinks Mod Start
$SkimPubID = “12345×123456″;
$url = “http://go.redirectingat.com?id=”.$SkimPubID.”&xs=1&url=http%3A%2F%2F”.$rover['url'].”%2F”.$ktv['item'].”%2F”;
$ktv["pid"] = 1;
//SkimLinks Mod End
4. Replace the 12345×123456 with your Publisher ID that you got in step 1
5. The $ktv["pid"] is optional, it’s the eBay CampaignID so you can track all SkimLinks clicks in QCT under campaign 1

Entries (RSS)