Archive for the “PHPBay” Category

eBay has made some changes to its affiliate feed to be implemented before the 2011 Christmas season. Here are the changes in the phpBay files to be made for each phpBay install:

config.php

There are 3 changes that can quickly be made:

1. Under the Preferred Country Section all of the country codes need to be updated. The entire section needs to be replaced.

2. Under Advanced Options the Default Sort Order has changed. Instead of a ‘0′ there are now various words to be used to select the sorting of the eBay listings. They are listed in the new file.

3. There is also now an option to show items only from top rated sellers. You may not need this in your config.php file if you do not care about this option. Most users won’t.

ebay.php

Many, many changes in this file. Which is a major pain in the butt if you are running a customized version of the script.

My best recommendation is to take the new ebay.php file and rework into the the customizations. Adding the customizations back in from the phpbay customization page takes only a minute.

auction.php

Again, 3 changes to be made.

1. Since the country codes in config.php have changed, near the end of auction.php those codes similarly need to be changed. You will want to swap out the entire ebayCountries array to have the new codes.

2. Then, at the very end where there is a ’switch’ command with various “cases” – those are all related to the country codes so they also need to be replaced with the coding. The new coding is actually a lot simpler.

3. The final url variable starting $url, almost at the very end of the file, needs to be updated with the new code.

Reasons why you do not simply want to copy over the new auction.php file:

- Custom IP blocks
- Custom page redirects for bad IPs/bots
- Custom coding for using QCT to track clicks

Other Files

New versions of these files are also included in the new download package:

forms/form.sort_by.php
includes/combo.php; country.php, geo.php, geoip.dat, geoop.inc
templates/template.column.results.html

Misc

The price provided by eBay includes the dollar sign. So if your template has $ followed by the price code, delete the “$” because otherwise the prices for your listings will appear as $$.

eBay defaults to showing listings sorted by a Best Match. The phpBay config file default is to sort by the soonest ending time. Stick with the default to help avoid the listings matching the order of the eBay listings. Also known as duplicate content.

The new phpBay also seems to be showing 10 listings per page, even if you change the number in the config.php file. Changing the number shown in the web page call to the script still works. So for customization that is now the place to put a randomizing factor for the number of listings shown.

Comments No Comments »

Numerous websites and web pages using phpBay have been nuked with the Google Panda updates. Basically, thin sites consisting of just ebay links are at even bigger risk of being dropped by Google. Not just penalized in the search rankings, but dropped out of the search rankings.

Thin affiliate site + Panda is not a good combination.

This, then, is implementation with phpBay of the concept in this post about creating JavaScript links:

http://internetprofituniversity.com/blog/how-to-create-links-google-cannot-follow/

Step 1 – Make your javascript link file is writable using chmod.

Step 2 – In the phpBay template delete the standard link to the product. Now add a JavaScript link, but include a reference to an eBay item ID like this:

<div onclick=”javascript:link%%item_id%%()” style=”text-decoration: underline; color: blue; cursor:pointer”>Click Here</div>

Big tip: the link reference must begin with a letter. Not a number. So it cannot be javascript:item_id because eBay item id’s start with a number. You need to add at least one letter in front.

The item_id reference pulls the product id obtained by the script.

Step 3 – In the phpBay ebay.php file you need to open the javascript links file, add the reference ID and url for each product ID shown on a page, then close the file. This is the code:

$filename = ‘/home/webhostname/public_html/yourdomain.com/yoursubdirectory/yourfile.js’;
$somecontent = “function link” . $this->item_id . “() { location.href=’http://rover.ebay.com/rover/1/711-53200-19255-0/1?icep_ff3=2&pub=YOUREPNID&toolid=10001&campid=” . $this->eb_pid . “&customid=&icep_item=” . $this->item_id . “&ipn=psmain&icep_vectorid=229466&kwid=902099&mtid=824&kw=lg’; }\n”;
$fp = fopen($filename, ‘a’);
fwrite($fp, $somecontent);
fclose($fp);

Tips: You cannot use a direct file reference to the javascript file as the filename. That is: httpx://yourdomain.com will not work. At least it did not for me with HostGator. It had to an internal reference to the javascript file.

The references to item_id again pull in the reference to the particular product. eb_pid gets your EPN campaign ID number. You could hard code this if you only have one website, but this makes it easier to plug in this code for multiple script installations.

Step 4 – The code for Step 3 works for me after this line in ebay.php (your line may be different if you have already used some of the customization techniques outlined in a different post for phpbay):

$this->link_url = $this->site_url . $this->url_prefix . $this->urlText($item['title']) . “_” . $this->item_id . $this->eb_custom_cid . “.html”;

One downside is that although phpBay is being used, this method does not use phpBay seo links. It undoubtedly could be modified to work with the urls the script creates, but if the idea is to keep Google from seeing the affiliate link it really doesn’t matter. That’s why you’re doing this in the first place.

Also, the clicks do not show up in the QCT add-on because the JavaScript links are not going through the phpBay script code, but instead straight to eBay. Again, someone could modify this, but to simplify matters (and because my phpBay code is so heavily modified), for now it was easier to use pure eBay affiliate links. Since these links are generated by the EPN link generator tool they should be fine.

It remains to be seen if bad bots can click on these links, but I don’t think they will be able to as they will not ’see’ the links.

Step 5 – To avoid problems with JavaScript object not found errors because the eBay product link does not actually exist when the web page is accessed:

THE WEB PAGE JAVASCRIPT REFERENCE MUST BE AFTER THE LINKS FILE IS CREATED AND POPULATED. PUT IT IN YOUR FOOTER INSTEAD OF A PAGE HEADER

In addition,

- Create a javascript file
- Clear the contents with each page access
- Write the new product links
- Add in filler links if there are less than 10 products on a page
- Use a custom javascript file for each web page. This requires identifying the page name, passing that as the javascript file name, and passing that variable to the ebay.php file. (Note: this requires adjusted the API call in web pages and modifying ebay.php to accept the new variable.)

Update: Creating JavaScript Links and Working with the New phpBay API and eBay RSS feed

Here are my steps to ensuring the JavaScript links work, errors are fixed (step 5 above), and everything works with the new eBay feed rolled out before the end of 2011:

1. Add the customizations and JavaScript functionality into the new ebay.php file.

2. Update the template file.

3. Update all web pages to (1) obtain a javascript file name and (2) pass the new variable to phpbayPro.

I was doing the first in a meta includes file so it is easy to make the change sitewide – but running into JavaScript object expected errors. Moving the JavaScript reference to the footer solved the problem.

I do the latter by modifying the phpbay script call. This can be done with a global search and replace across html files. For WordPress look for a plugin called Search Regex. It is explained here.

Comments 1 Comment »

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

Comments 5 Comments »