Follow

How to Set Up Rewarded Video (Virtual Currency)

Please Note:

  • Only available for aerWall (Rewarded) Ad Placements
  • Only applies to Video Ads

 

 
Step 1: Create an Ad Placement
 
PLEASE NOTE: 

To set up an Ad Placement, you will first need to create an App. For detailed instructions on how to create an App, please click here.

  1. Go to the "Inventory" tab in the nav bar and press the "+" icon next to the app you want to add an Ad Placement to.

  2. Specify the Ad Product that will be delivered to this new Ad Placement. For each ad product selected, a separate placement will be created. 

 

 
Step 2: Select the aerWall (Rewarded) Ad Product
  1. Enter a Name for this Ad Placement. This will be used throughout the platform to reference this Ad Placement.
  2. Select whether you would like the video ad to be Skippable or not.
  3. Set a Frequency Cap for the video ad.
  4. Enter the Currency Name. This is the name that will be returned on the VC completed event callback.
  5. Select Callback: Client or Client + Server.
  6. Enter the Reward Amount per completed view. This is the amount that will be returned on the VC completed event callback.
  7. When you are done, click on Next!

 

Step 3: Integrating Virtual Currency Events
 
iOS SDK
 

 

For the iOS AerServ SDK, Virtual Currency information will be passed through the ASInterstitialViewControllerDelegate protocol. The parent view controller will conform to this protocol. When creating your ASInterstitialViewController object, be sure to set the delegate to the parent view controller.

 

Inside the parent view controller, define these two methods:


- (void)interstitialViewControllerDidVirtualCurrencyLoad:(ASInterstitialViewController *)viewController vcData:(NSDictionary *)vcData;

- (void)interstitialViewControllerDidVirtualCurrencyReward:(ASInterstitialViewController *)viewController vcData:(NSDictionary *)vcData;
    

From these two callback methods, all pertinent Virtual Currency information will be received. Please check the ASInterstitialViewController’s header file to see more information about the dictionary’s contents.

 

 

Android SDK

For the Android AerServ SDK, Virtual Currency information will be passed through the VC_READY (fires before a VC enabled Ad plays) and VC_REWARDED (fires after a VC enabled Ad has completed) Events through the Event Listener you have configured. Cast the first object of the args parameter to an AerServVirtualCurrency object and use .getName() and .getAmount() to get the VC Name and Amount configured for that Ad Placement. 

 

See example below:

AerServEventListener listener = new AerServEventListener(){
    @Override
public void onAerServEvent(AerServEvent event, List args){
        switch (event) {
            case VC_REWARDED:
                AerServVirtualCurrency vc = (AerServVirtualCurrency) args.get(0);
                // do something here with your virtual currency!
                log.d("AerServVirtualCurrency", "VC rewarded: " + vc.getAmount() + " " + vc.getName());
        }
    }
}

AerServConfig config = new AerServConfig(this, "1003694").setEventListener(listener);
new AerServInterstitial(config).show();


 

 

 

Unity SDK

In order to enable Virtual Currency callbacks for Unity, the following two Events are required to be added to the Unity Project:


 /** Event Callback**/
        [MonoPInvokeCallback (typeof (OnAerServEvent))]
        static void aerServEventCallBack(int eventType, String args) {

            String[] argsArr = (args != null) ? args.Split('|') : null;

            switch(eventType) {
         
                case SDK.VC_READY:
                    message += del + "VC_READY invoked! Name: " + argsArr[0] + " Amount: " + argsArr[1];
                    break;
                case SDK.VC_REWARDED:
                    message += del + "VC_REWARDED invoked! Name: " + argsArr[0] + " Amount: " + argsArr[1];
                    break;
                default:


 
 
 
Step 4: Test Virtual Currency with Test Ad Placements (OPTIONAL)
 
 
To test VC with Test Ad Placements (PLCs), you can use the following:
 

1003694

1003694

  

Summary of SDK mediation networks that support Virtual Currency events:


PARTNER
AD TYPE
VC ENABLED
Interstitial Yes
Interstitial Yes
Interstitial Yes
Interstitial Yes
Interstitial Yes

 

 

 

Step 5: Virtual Currency with Server Side (OPTIONAL)

  1. Select Client + Serverside Callback 
  2. Enter a Callback URL
  3. Use the Secret Key to create a HMAC for additional security

Passing in user id is a required method needed for frequency capping by request. 

SDK setup

IOS Method Call:  

@property (nonatomic, strong) NSString *userId; 

Android Method Call: 

setUserId(String)

//Code Example// AerServConfig Config = new AerServConfig(this, "1000741");
config.setUserId("myID")

Unity Method Call: 

config.Add(SDK.PARAM_USER_ID)

//code Example//
Dictionary<string, object> config = new Dictionary<string,
object>(); config.Add(SDK.PARAM_USER_ID, "AerServ Test User");
config.Add(SDK.PARAM_TIMEOUT_MILLIS, 10000);
SDK.LoadInterstitial(plc, aerServEventCallBack, config);

Minimum Sample Callback url: 

http://www.rewardurl.com/?user=$[vc_user_id]&amount=$[vc_award_amount]&currency=$[vc_name]

 

Full Sample Callback url: 

http://www.rewardurl.com/?user=$[vc_user_id]&amount=$[vc_award_amount]&currency=$[vc_name]&rid=$[rid]&hmac=$[hmac] 

 

Example URL Response codes: 

http%3A%2F%2Fwww.rewardurl.com%2F%3Fuser%3D%24%5Bbtha-e4bdf-4sjst4-4bgss%5D%26amount%3D%24%5B1%5D%26currency%3D%24%5Bpoints%5D%26rid%3D%24%5Bcvagy-svart-avgh-agbhj%5D%26hmac%3D%24%5Bhmac%5D%20%0A

 

Example url callback:
http://www.dantest.com/?user=testandroid&amount=500.0&currency=vc+test&tid=64c30cf4-4fd8-4246-a6b4-664a7e4601a0&validator=248c185f51da79759c9f791c76bf9e52c3028714

In this site:
https://md5hashing.net/hash

Enter following to Encrypt and look for results for Sha1 (rid+currency+amount+user+secretkey):
64c30cf4-4fd8-4246-a6b4-664a7e4601a0+vc test+500.0+testandroid+2712335A84C11

   

NAME
VC Currency Macro
Required
Recommend
UseCase
Virtual Currency ID $[vc_user_id] Yes Yes Verify User ID
Virtual Currency Amount $[vc_award_amount] Yes Yes Verify Currency Amount
Virtual Currency Name $[vc_name] No Yes Verify Currency Name
Virtual Currency RID $[rid] No Yes Verifying unique RID (REQUEST ID) for duplicate layer of additional layer of security and validation
Virtual Currency HMAC $[hmac] No Yes Verify All macro including secret key 

  

 

 

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

Comments

Powered by Zendesk