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

Skip down to comments...
Hope you found this post useful...

...so please read on! I love writing articles that provide beneficial information, tips and examples to my readers. All information on my blog is provided free of charge and I encourage you to share it as you wish. There is a small favour I ask in return however - engage in comments below, provide feedback, and if you see mistakes let me know.

If you want to show additional support and help me pay for web hosting and domain name registration, donations, no matter how small, are always welcome!

Use of any information contained in this blog post/article is subject to this disclaimer.
 
comments powered by Disqus
Other posts you may like...