Script Templates Tips

This page explains how the Smart Display SDK can be used to create custom ad experience inside your app.

  1. Extra parameters on ad element

Extra parameters on ad element

Smart Display SDK is able to receive extra-parameters from ad templates.

One usage of these extra-parameters is to customize your application for a decicated campaign, for example by providing some extra UI settings/assets needed to enhance the ad experience (color, logo, etc).


On the application side, the extra-parameters can be retrieved by using the getExtraParameters API on the ad object that is passed after a successful load.


// using listener method onBannerAdLoaded for banner or onInterstitialAdLoaded for interstitial
mBannerView.setBannerListener(new SASBannerView.BannerListener() {
    @Override
    public void onBannerAdLoaded(SASBannerView bannerView, SASAdElement adElement) {
        // for example to retrieve a hex string color parameter to change the Toolbar background color
        HashMap extraParameters = adElement.getExtraParameters();
        if (extraParameters != null && extraParameters.get(sBarHexColorParameterKey) != null) {
        	String hexColorString = (String)extraParameters.get(sBarHexColorParameterKey);
        	// code to customize UI
    	}
    }
	...
}
		    

// using delegate method bannerView:didDownloadAd: for banner or interstitialView:didDownloadAd: for interstitial
- (void)bannerView:(SASBannerView *)bannerView didDownloadAd:(SASAd *)ad {
    // for example to retrieve a hex string color parameter to change the Navigation Bar color
    if(ad.extraParameters && [ad.extraParameters objectForKey:kBarHexColorParameterKey]) {
    	NSString *hexColorString = [ad.extraParameters objectForKey:kBarHexColorParameterKey];
    	// code to customize UI
	}
	// ...
} 
		    

To activate extra-parameters in your ad templates, please contact your Technical Account Manager.