Win8: AdRotator's default house ad used instead of mine

Dec 4, 2012 at 6:33 PM

Hi, in my AdRotatorControl (using v1.0.7) when I make SettingsUrl invalid, instead of falling back to the house ad I specified in the DefaultSettingsUri, it falls back to this: [http://adrotator.apphb.com/SampleRemoteHouseAdWin8.xaml].  I can't see how this is possible, since the latter file isn't referenced anywhere in my project, and neither is [http://adrotator.apphb.com/defaultAdSettingsWindows8dev.xml]. My only conclusion is that one of these locations is mistakenly hard-coded somewhere in the AdRotator component?

Here is my control:

<adRotator:AdRotatorControl 
x:Name="MyAdRotatorControl"
AdWidth="160"
AdHeight="600"
DefaultSettingsFileUri="AdRotatorLeft.xml"
SettingsUrl="http://adrotator.apphb.com/defaultAdSettingsWindows8devXXX.xml"
/>
(notice that I munged SettingsURL to be invalid)

Here is AdRotatorLeft.XML

<AdSettings xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <CultureDescriptors>
        <AdCultureDescriptor CultureName="default">
            <Probabilities Probability="0" AdType="PubCenter" AppID="809805da-d78b-4006-bc02-f67c10010410" SecondaryID="10048475" />
            <Probabilities Probability="100" AdType="DefaultHouseAd"/>
        </AdCultureDescriptor>
    </CultureDescriptors>

</AdSettings>

What's strange is that when I go into the Package folder and delete C:\Users\Dan\AppData\Local\Packages\[MyPackageFamilyName]\RoamingState - everything behaves as expected - my house ad (which I set as per the instructions in my page's code-behind) shows up (or my pubcenter ads, if I change the probabilities in AdRotatorLeft.XML).  How is AdRotator's test ad getting into my app at all?

thanks,

-Dan

Dec 4, 2012 at 8:18 PM

Hi Dan

 

Short answer is No, we don't hard code anything in the control, you can see for yourself in the source.

What I suspect is happening is that you ran the control at least once using the demo data and it has cached the default configuration XML in your roaming config,  by not specifying a new remote config file it will continue to use the cached one until it's updated, this is to ensure that if your remote config file fails for any reason it will continue to use the last downloaded one, the "Project" configuration file is only used if no network existed.

Not using a "SettingsURL" at all should prevent it from using the cached one.

Now one thing I did notice while I was working on the update is that because we used the roaming settings initially, if you ever used the test  remote config at any point using the same project reference from any machine using your Microsoft account, then Microsoft will cache the settings for you and replace them when you next connect, so deleting the project folder locally does not clear the config file.  In the next update I've changed this to use the Local Temp rather than roaming temp and let devs change this behaviour if they wish.

To get around this for now either start a new project if your app is just starting and don't use the settings URL in the demo code, or put your own config file remotely somewhere and point the config to it to clear it from your machine / account.  Granted neither of these solutions are ideal but you've hit one of the "safety" features which would keep AdRotator running if it was unable to get config which in a real world situation is a great help but in test, not so much.

 

Hope this helps.

Should have the next version available soon after we've concluded testing, if you have any suggestions for the update now would be a great time to suggest it.

Dec 5, 2012 at 5:23 AM

Thanks - I tried not using a "SettingsURL" and I still get AdRotator's house ad.  I also tried my own SettingsURL file (see below) and while changing the file that SettingsURL points to can change whether I get my pubcenter ad or a house ad, whenever I specify house ad, I still get AdRotator's house ad.  I can't imagine how this could still be cached somewhere.  Here is my XML:

<adRotator:AdRotatorControl x:Name="MyAdRotatorControl"
AdWidth="160"
AdHeight="600"
DefaultSettingsFileUri="AdRotatorLeft.xml"
SettingsUrl="http://www.highbrowgames.com/wordpress31/wp-content/uploads/XML/AdRotatorLeftHouseAd.xml" 
Log="MyAdRotatorControl_Log"
/>
The file pointed to by SettingsUrl basically has this in it:
<Probabilities AdType="DefaultHouseAd" Probability="100"/>
And of course I'm doing this in my code behind.
void GamePage_Loaded(object sender, RoutedEventArgs e)
{
 MyAdRotatorControl.DefaultHouseAdBody = new HouseAd();
 MyAdRotatorControl.Invalidate();
}
Here is what the logging output looks like:

Ads are enabled for display

Testing "DefaultHouseAd" - Result True

Ads being requested for: DefaultHouseAd

Ads being successfully served for: DefaultHouseAd

DefaultHouseAd Created

Ads being served for: DefaultHouseAd

Dec 5, 2012 at 5:32 AM

I should correct myself - what I said above ("I can't imagine [the AdRotator house ad] could still be cached somewhere") was wrong - it *could* still be cached...

But since I've provided completely valid data and uninstalled/reinstalled/restarted the app, the cached data should be updated with the new, valid data. Having the cache in a state where it could never be updated and continuously serves up the first ad you ever saw seems bad. Either way your fix to use local storage sounds promising, but I'm worried if you just update "roamingsettings" with "localsettings" that the AdRotator house ad will get "stuck" there like it is for me now.

One other possiblity is that perhaps it thinks I have a remote house ad (which I don't) and is falling back to your remote house ad.  But in the wiki it says "we only support local house ads and AdDuplex"

thanks again,

-Dan

Dec 5, 2012 at 11:33 AM

The Windows 8 version currently supports:

  • Local House Ads
  • Remote House Ads
  • AdDuplex
  • PubCenter

The cached data is replaced when a new remote ad is downloaded, however we don't get a new remote ad if the URL hasn't changed from the last attempt (so to reduce the amount of web calls AdRotator makes)

Will see if I can add some more options to control this behavior to the next update

Dec 7, 2012 at 8:16 AM

"we don't get a new remote ad if the URL hasn't changed from the last attempt (so to reduce the amount of web calls AdRotator makes)"

Okay, but I changed the URL twice, does it keep a table of URLs vs ads? It seems problematic that the control is "stuck" on this one ad.  Sorry if I'm too thick to understand what the problem is.  In any case, is there any method to clear the cache?  I feel like there's a possibility the cache isn't actually the problem, so that would eliminate that possibility.  

My end goal is to get my local house ad to show up 10% of the time. This is why I want to use AdRotator - to display my house ad 10% of the time without writing the code for it (lazy :).  So far I've not been able to make my house ad show up ever, except by manually deleting the aforementioned "RoamingSettings" folder.

Anyway, looking forward to the update!

-Dan

Dec 7, 2012 at 11:59 AM

I'll be sure to do specific testing for your use case to ensure the remote ad is refeshed when updated.

The other reason for only updating on change of the URL is that the phone framework has an odd caching process, we've noticed this with downloading the config XML sometimes and either the file has to be significantly changed or enough time has to pass for the cache to expire (undertermined)

But in any case I'll run this through a battery of tests to get your desired outcome.

The cache clearing idea is a good one, i'll also see if I can add an option for that but as it would have to be in the config XML that might have to wait until V2

Dec 7, 2012 at 6:58 PM

Awesome, thanks! Looking forward to getting this into my Win8 apps!

Dec 11, 2012 at 12:39 PM

Windows 8 NuGet package updated, check it out and let me know

Dec 17, 2012 at 6:09 PM

Awesome - everything appears to work as I expect now - thanks!