Skip to content

Instantly share code, notes, and snippets.

@ydn
Created June 10, 2015 23:04
Show Gist options
  • Save ydn/eefb68232405c3363630 to your computer and use it in GitHub Desktop.
Save ydn/eefb68232405c3363630 to your computer and use it in GitHub Desktop.
Configure Ad Serving (Swift)
// Example of enabling the test mode
{
let adInterstitial = FlurryAdInterstitial(space:"ADSPACE");
adInterstitial.adDelegate = self;
let adTargeting = FlurryAdTargeting();
adTargeting.testAdsEnabled = true;
adInterstitial.targeting = adTargeting;
adInterstitial.fetchAd();
}
// Example of setting the user's location to support ad targeting
func locationManager(manager: CLLocationManager!, didUpdateLocations newLocation: CLLocation) {
let adInterstitial = FlurryAdInterstitial(space:"ADSPACE");
let adTargeting = FlurryAdTargeting();
adTargeting.location = locationManager.location;
adInterstitial.targeting = adTargeting;
adInterstitial.fetchAd();
}
// Example of setting user cookies to be appended to the rewarded ads server side callback
func showInterstitialAddUserCookies {
let cookies = ["xyz123": "UserCharacterId"];
let adInterstitial = FlurryAdInterstitial(space:"ADSPACE");
let adTargeting = FlurryAdTargeting();
adTargeting.userCookies = cookies;
adInterstitial.targeting = adTargeting;
adInterstitial.fetchAd();
}
// Example of setting keywords to be used in keyword targeting
func showInterstitialAddKeyWords() {
let keywords = ["UserParameterName": "UserParameterValue"];
let adInterstitial = FlurryAdInterstitial(space: "ADSPACE");
let adTargeting = FlurryAdTargeting();
adTargeting.keywords = keywords;
adInterstitial.targeting = adTargeting;
adInterstitial.fetchAd();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment