Jonas Stawski

Everything .NET and More

Debugging the Windows Phone Ad Control

I’ve written previously about my lessons learned of the Windows Phone 7 ad control and it appears as I haven’t learned my lesson yet. About a month ago Champions League Tracker hit the Marketplaceand it appears to be very successful: from 11/28/2011 to 12/17/2011 the app has been downloaded 2,084 times. Go ahead, download it, I’ll wait for you. There is a small problem, though, I haven’t made a single dime yet. Why? Because I decided to go with an ad based model on this one, but the pub center did not register a single impression since launch. To me it seemed weird, because during development I was seeing ads and then at one point they disappeared. I thought it was Microsoft limiting my ads or they figured the app was being used from the emulator so I paid no attention to it and published the app to the Marketplace. Then I realized there was a problem, so I decided to fix it along with other bugs. Sometimes I had ads and sometimes I didn’t. Since I had a fallback mechanism (another post on this later) for when no ads were available I didn’t worry too much. So today was the first day of the new version out in the wild and after checking for ads several times throughout the day I noticed there were still no ads. Furthermore, I asked a few of my peers to check it out and they came back with the same result. So I decided to investigate.

I figured the Ad Control would make some sort of HTTP call, so I decided to fire up Fiddlerand inspect the traffic. I followed this post on how to intercept the traffic from the emulator and started sniffing away. Since the Ad Control uses HTTPS, you also have to install Fiddler’s root cert into the emulator by following these directions. So I fired up the emulator and I’m anxiously watching Fiddler for some data to popup when I see this beautiful sighting:

image

I then went ahead and inspected the request only to see the following URL being used: /v3/Delivery/Placement?pubid=[someguid]&pid=[someid]&adm=2&cfmt=text,image&sft=jpeg,png,gif&w=480&h=80&fmt=json&cltp=app&dim=le&lc=en-US&idtp=mid&uid=[someotherguid].

I copy the URL in my browser and get a JSON response which basically said there were no ads to display. Thank you, Sherlock! So I decided to check the querystirng parameters one by one. As it turns out, pubid is the Application ID. At this moment I decided to compare it with the actual ID and low and behold, it was WRONG! It was very similar, but not exact! Maybe at some point in time of my development I changed the ID by mistake or something. So I change it back to the right one and my ads start working again.

So to conclude, just like I said more than a year ago:

If it doesn’t work on the emulator it will probably not work on the device.

So debug it before you submit to the marketplace!

Happy programming!

Comments (1) -

How are you dealing with multilingual ads? The adControl doesn't seem to detect the CultureInfo, (or they don't have ad content for non-english apps).

Reply

Add comment

biuquote
Loading