Igor Kromin |   Consultant. Coder. Blogger. Tinkerer. Gamer.

I've purchased many an item from Banggood simply because they offer interesting things at low prices. I also am signed up as an affiliate so that I can have an additional funding source for this Blog. One of the annoying things that I've found with their affiliate program is the need to copy each of their advertising banners manually by hand every month. That in fact prevented me from putting their advertising on my Blog, until now.
Update 01-August-2017: This no longer works! Banggood changed their web site and made is forcing everyone to collect banner ad code manually.


This weekend I decided to play around with the Referral Code & Report part of their site to see if I could do something to help getting the banner code a bit easier. With a little bit of JavaScript I was able to automatically extract all of the banner code in one go without having to click through all the screens. Here's how.

Bit of a disclaimer before you continue: use this at your own risk of course. Banggood can change the behaviour of their site at any time, but this works for now at least. The code is completely safe to use, it isn't a hack, it's just using the functions provided by the website already.

You will need an account with Banggood. You will also need to be signed up as an affiliate. Go to the Referral Code & Report and bring up the JavaScript/Development Console in your browser. The referral page looks something like this:
banggood_code1.png


Enter the following into the JavaScript Console and wait for the updated page to finish loading.
 JavaScript
changeShowNum(200);


That changes how many banner ads the site shows to you in one go. The number 200 seemed like a good amount for me, it doesn't actually go up that high, but better to try and show more than having to go through multiple pages.

Next enter the following code:
 JavaScript
selbannerimagesize(13);getBannerlist();




That tells the site to load 728x90 banners. You can tell it to load others e.g. 336x280 if you change that 13 to a 4. Different numbers here correspond to different banner sizes, I didn't try to document them all.

Now that all the banners of the same size have been loaded it's time to extract their codes. Enter the following into the JavaScript Console and run it:
 JavaScript
var s = '\n'; $('.banner_code_list').find('li').each(function(idx, el) { var e = $(el); s += '<a rel="nofollow" href="' + e.find('a').attr('href') + '" target="_blank"><img src="' + e.find('img').attr('src') + '"/></a>\n'; }); console.log(s);


That puts all of the banner code into the console, which you can then select and copy. The approach used here is the same as Banggood does itself so should work identically.
banggood_code2.png


-i

Please leave your comments or feedback below!
comments powered by Disqus
Other posts you may like...
Hi! You can search my blog here ⤵
Or browse the recent top tags...

Recent Blog Posts

Review of Stellar Phoenix Photo Recovery software for Mac

A year later and GitLab still doesn't allow to show private project activity

How to remove caked on stickers from old game carts

How to pass parameters to your PHP script via the command line

jPhotoFrame new layout engine explained with examples

Atari Lynx Multi SD Card cartridge review

Jersey JAX-RS filters and interceptors execution order when throwing Exceptions

Why I'll never renew a domain with GoDaddy again

Fake AirPods - HBQ-i7 TWS wireless headset teardown

How to fix Postman error - Failed to import data: format not recognized

Recent Galleries

BMB-012 Nanoblock T-Rex Skeleton Model assembly

Tiny Arcade revision 6 kit assembly and decal application

Atari Lynx repair - Part 5 - McWill LED screen mod installation

Atari Lynx repair - Part 4 - screen cover replacement

Atari Lynx repair - Part 2 - re-capping the motherboard

Atari Lynx repair - Part 3 - broken speaker replacement

Atari Lynx repair - Part 1 - introduction and case disassembly

Building a custom Atari Lynx game box storage shelf unit in a day

Protecting old Atari Lynx game boxes with snug fit plastic sleeves

Monument Valley 2 is released and does not disappoint

Blogs and Friends

Matt Moores Blog
Georgi's FlatPress Guide
Perplexing Permutations
The Security Sleuth
Ilia Rogatchevski
Travelling Fairy

Blog Activity

Blog Activity