Brian Dunning Brian Dunning If you know Brian Dunning at all, it's probably as the host of "Skeptoid," a podcast that debunks pseudoscience. Recent episodes have discussed UFOs, aliens, and free energy machines.

But for the last few years he's been fighting eBay and the FBI in court over allegations that he cheated the auction site out of $5.2 million in an ingenious "cookie stuffing" affiliate marketing scam.

Yesterday, he gave up that fight, and pleaded guilty to wire fraud in a California federal court. He faces 20 years in prison.

On his blog, he previously protested his innocence:

Some bloggers and commenters have claimed that I personally made outrageous amounts of money. This is demonstrably false. Although I did well for the better part of a year, most of the money mentioned in the suit was earned by another affiliate, and our chunk was divided into many different pie slices. I was only one of those slices, despite being the only one criminally charged from our company. I’ve already spent more money in legal fees than I earned from eBay.

The chronic stress has been very hard, on me and on my family. The financial devastation has been nearly complete. The psychological and emotional toll, during the most formative years of my children’s lives, can never be recouped. The image that my children have of me has always been one of my top priorities; and I’m angry that this has happened to them. I’m angry that my amazing wife has had to add, to her already too-long list of responsibilities and stressors, the need to spend full-time keeping me together as a person. It’s not right.

Here's how it happened.

Back in 2006, Dunning joined eBay's affiliate marketing program, using a company called "Kessler's Flying Circus," or KFC. EBay offered generous terms: It would pay $25 for each new member any affiliate brought to the site, and 50% of certain sales over $100 after that, according to the indictment against Dunning.

So, eBay alleged in a civil lawsuit, Dunning devised a system to rig the game in his favor. According to Ars Technica, he created a widget called "WhoLinked." The widget allowed bloggers and webmasters to install it on their sites, and see who was linking to them. Crucially, the widget had nothing to do with sales on eBay. It was merely an easy-to-use device for bloggers to look at their traffic.

But, Ars Technica reports, the widget had another purpose: Any time someone looked at a blog page with the WhoLinked widget on it they received an eBay affiliate tracking cookie.

If, at any time after that, the user then went to eBay and conducted a transaction, Dunning's cookie would get credit for the sale — even if WhoLinked actually did nothing to drive the sale.

Normally, tracking cookies are small pieces of code that advertisers use to track people as they browse the web. They don't record personally identifiable information, but they may tell advertisers that an anonymous user who was just shopping for shoes on one site has now arrived on another site. That user can expect to see shoe ads popping up on the second site, as advertisers target the cookie they picked up on the first one.

Normally, the cookie is directly relevant to what the user is doing. But some web site owners noticed that WhoLinked was serving irrelevant links to eBay.

In 2006 and 2007, KFC earned $5.2 million from eBay, and became the company's No.2 driver of new affiliates, the FBI alleged in a "superseding information" filing in federal criminal court.

EBay accused him of taking financial credit for users who had no clue they were carrying an eBay cookie. (Normally, affiliate marketers drive traffic to eBay by advertising eBay products on their sites — so it's really obvious that the affiliate drove the click-through to eBay.)

Dunning fought both eBay and the feds for years, but on April 15 he changed his mind and pleaded guilty.

He will be sentenced some time after August, once the court has decided what his financial liability is.