Ads are standard sizes as defined by the IAB (Internet Advertising Bureau). Mobile banners are 320x50. Though they could come in as 300x50. If you’re on a tablet, you will get likely get a “leaderboard” which is 768x90. I guess it’s possible if you’re on a device that’s not going to accommodate a 768px wide leaderboard, but your device is in the 600 point range, an advertiser could send a 468x60, but the fill rate on those is quite low.
As for your code, I don’t know how your determining common.w, but if that’s something like display.contentWidth, then that value will be determined by your config.lua, but that doesn’t map to your device’s point size. This is another reason why we recommend a 320x480 content area. Let me try and explain. If you say have a config.lua of 640 wide and 960 high and you use your code, you’re going to expect to get a 468x60 ad, but if you’re on a phone, you’re going to get a 320x50 banner ad.
A more appropriate test is to determine if you’re on a phone or tablet. For iOS, this is pretty strait forward, you can simply get the device type an see if the string “iPad” is in the description or not. For Android, it’s a bit tricker. You could use the system.getInfo() API and get the androidDisplayWidthInInches and see if you’re on a 6" or larger screen (or 5", etc.). See:
https://docs.coronalabs.com/api/library/system/getInfo.html#androiddisplaywidthininches
Rob