Unity

From POKKT DOCUMENTATION
(Redirected from Unity Android)
Jump to: navigation, search

POKKT SDK v8.0.0 (GDPR Compliance) Unity3d

Last Update: 2nd June, 2020

Download Latest Version Here.


Integration Guide v8.0.0

Overview

Thank you for choosing Pokkt SDKfor Unity. This document contains all the information required to set up the SDK with your project. We also support mediation for various third party networks. To know the supported third party networks and their integration process go to mediation section .

You can download our SDK from pokkt.com

We will be referencing PokktAds Demo( Sample App ) provided inside the SDK downloaded above during the course of explanation in this document. We suggest you go through the sample app for better understanding.


Implementation Steps

SDK Configuration

  1. Set Application Id and Security key in Pokkt SDK. You can get it from the Pokkt dashboard from your account. We generally assign unique application-id and security-key.
    PokktAds.SetPokktConfig(string appId, string securityKey, INativeExtension nativeExtension, bool isDebuggingEnabled = false);
  2. When your application is under development and if you want to see Pokkt logs and other informatory messages, you can enable it by setting ShouldDebug to true . Make sure to disable debugging before release.
    PokktAds.ShouldDebug(bool value);
    PokktAds.ShowLog(string message);
    PokktAds.ShowToast(string message);

Ad Types

FullScreen Ads
  1. Full-screen ads can be rewarded or non-rewarded and video or interstitial. You can either cache the ad in advance or directly call show for it.
  2. We suggest you cache the ad in advance so as to give seamless play behaviour, In other case it will stream the video which may lead to unnecessary buffering delays depending on the network connection.
  3. ScreenId: ​This one parameter is accepted by almost all API’s of Pokkt SDK. This controls the placement of ads and can be created on Pokkt Dashboard. We will be referencing the ​PokktAds Demo ​app provided with SDK during the course of explanation in this document. We suggest you go through the sample app for better understanding.
  4. To cache Full-screen ad call:
    PokktAds.CacheAd(string screenId);
  5. To Show Video Ad:
    PokktAds.ShowAd(string screenId);

    You can check if an ad is available, before making a show request.

    PokktAds.IsAdCached(string screenId); 
  6. Ad actions are optional, but we suggest to implement them as it will help you to keep track of the status of your ad request.
    public static event Action<string, float> AdCachedEvent;
    public static event Action<string, string> AdFailedToCacheEvent;
    public static event Action<string> AdDisplayedEvent;
    public static event Action<string, string> AdFailedToShowEvent;
    public static event Action<string, bool> AdClosedEvent;
    public static event Action<string> AdClickedEvent;
    public static event Action<string, float> AdGratifiedEvent;
    public static event Action<string> BannerLoadedEvent;
    public static event Action<string, string> BannerLoadFailedEvent;
    

There are two ways to load banners:

  1. Load banner

     PokktAds.LoadBanner(string screenId, int position);

    There are predefined positions for banner positioning inside BannerPosition( Com. Pokkt.Plugin.Common.BannerPosition ) .

    TOP_LEFT.
    TOP_CENTER.
    TOP_RIGHT.
    MIDDLE_LEFT.
    MIDDLE_CENTER.
    MIDDLE_RIGHT.
    BOTTOM_LEFT.
    BOTTOM_CENTER.
    BOTTOM_RIGHT.

  2. Load banner with rect

     PokktAds.LoadBannerWithRect(string screenId, int height, int width, float x, float y); 

    Height : Custom height for banner.
    Width: Custom width for banner.
    x: Point x on screen to show banner.
    y: Point y on screen to show banner.

  3. You can remove Banner using:

     PokktAds.RemoveBanner(); 
IGA (In Game Ad)

Introducing a new way to monetize the game. Currently it works only for Android but soon will be available for iOS. Using Pokkt IGA (In-Game Ads) you can use your in-game objects to display ads. Pokkt IGA use a less intrusive way to achieve this. Refer our sample for a better understanding. Our existing SDK + Unity Plugin has this feature from version 6.0.

Types of Ads:

We support three different types of Ad:

  1. Banner Ads: These are image-based advertisements that can be placed anywhere in your game.
  2. Hoarding Ads: These are also image-based advertisements but larger in size as compared to the banners. These can also be placed anywhere in your game but we suggest you to place them in game objects like hoarding, as these are large and serves better purpose there.
  3. Floating Ads: This Ad Unit itself consists of two image sources unlike its counterparts.
    • Icon: It shows a small interactive image of the size of standard icons. On clicking on this icon it will open a full screen image
    • Full Screen Image: It shows a full screen image with close button on its top right corner. The content of this image will further describe what that icon was about. This image has a “click through” assigned to it which will take the user to browser for further action or interaction if user wish to.
How to use InGame Ad Units:
  1. Banner Ads:
    • Using Pokkt Menu: Select your game object on which you want to add banner as highlighted in below image. We suggest to use “Quad” as “GameObject” as placement for banner although it’s not mandatory.

      bordered

      As a result of above step “Pokkt IGA Container” script gets attached to your “GameObject” with “Banner” selected as AdType. You can assign “Player Camera” also if required but it’s optional.

      bordered

    • Programmatically:
      PokktIGAContainer.AddIGABanner(yourIGAGameObject)
  2. Hoarding Ads:
    • Using Pokkt Menu: Select your game object on which you want to add banner as highlighted in below image. We suggest to use “Quad” as “GameObject” as placement for hoarding although it’s not mandatory.

      bordered

      As a result of above step “Pokkt IGA Container” script gets attached to your “GameObject” with “Hoarding” selected as AdType. You can assign “Player Camera” also if required but it’s optional.

      bordered

    • Programmatically:
      PokktIGAContainer. AddIGAHoarding (yourIGAGameObject)
  3. Floating Ads:
    • Using Pokkt Menu: Select your game object on which you want to add Floating Unit as highlighted in below image. We highly recommend you to add “ Button” as '“GameObject” as placement for floating unit.

      bordered

      As a result of above step “Pokkt IGA Container” script gets attached to your “GameObject” with “Floating Unit” selected as AdType. You can assign “Player Camera” also if required but it’s optional.

      bordered

    • Programmatically:
      PokktIGAContainer. AddIGAFloatingButton (yourIGAGameObject)

IGA Collectibles and Boosts can only be assigned programmatically. Collectibles are in-game objects that a player collects during a gameplay, for example “Coins”, “Gems” etc. Boosts are collectibles with instant bonuses, powerups can be put in this category. Collectibles and Boosts are smaller textures compared to IGA Banners and hoardings.

PokktIGAContainer.AddIGACollectible(yourIGAGameObject);
PokktIGAContainer.AddIGABoost(yourIGAGameObject);
Note:

You still need to set your App ID and Security Key before you can fetch IGA Assets.
To fetch assets call:

PokktAds.InGameAd.Fetch(<”<ScreenName>”>);

Additional SDK Configuration

GDPR

As of May 25th, the General Data Protection Regulation (GDPR) will be enforced in the European Union. Set GDPR consent in Pokkt SDK. This must be called before calling any ad related API. Developers/Publishers must get the consent of the user. For more information on GDPR please refer https://www.eugdpr.org/ and https://www.eugdpr.org/gdpr-faqs.html. This API can again be used by publishers to revoke the consent. If this API is not called or invalid data provided then SDK will access the users personal data for ad targeting

ConsentInfo consentInfo = new ConsentInfo();

consentInfo.isGDPRApplicable = true;

consentInfo.isGDPRConsentAvailable = false;

ConsentInfo.SetDataAccessConsent(consentInfo);

ThirdPartyUser Id

If you are using server to server integration with Pokkt, you can also set Third Party UserId in PokktAds.

PokktAds.SetThirdPartyUserId(string userId)

Pokkt ad player configuration

Pokkt Ad player works the way App is configured at Pokkt dashboard, but we provide a way to override those settings using PokktAdPlayerViewConfig.

Application should prefer configuration provided through code by developer or what’s configured for the app in dashboard, can be controlled any time through the dashboard itself. If you want to make changes to this configuration after your app distribution, you can contact Pokkt Teamto do the same for your app through admin console.

PokktAdPlayerViewConfig adPlayerViewConfig = new PokktAdPlayerViewConfig ();
// set properties values to adPlayerViewConfig
PokktAds.SetAdPlayerViewConfig(adPlayerViewConfig );

Various properties that can be managed through this are:

  1. Back button
    Defines if user is allowed to close the Advertisement by clicking on back button or not.
    Property Name: BackButtonDisabled
    Values:
    True = Back button is disabled and user cannot close the Ad.
    False = Back button is not disabled and user can close the Ad.
  2. Default skip time
    Defines the time after which user can skip the Ad.
    Property name:DefaultSkipTime
    Values:
    Any Integer value.
    Default value is 10 seconds.
  3. Should allow skip
    Defines if user is allowed to skip the Ad or not.
    Property name:ShouldAllowSkip
    Values:
    True = User can skip Ad.
    False = User can’t skip Ad.
  4. Should allow mute
    Defines if user is allowed to mute the Video Ad or not.
    Property name:ShouldAllowMute
    Values:
    True = User can mute video Ad.
    False = User can’t mute video Ad.
  5. Should confirm skip
    Defines if confirmation dialog is to be shown before skipping the Ad.
    Property name:ShouldConfirmSkip
    Values:
    True = Confirmation dialog will be shown before skipping the video.
    False = Confirmation dialog will not be shown before skipping the video.
  6. Skip confirmation message
    Defines what confirmation message to be shown in skip dialog.
    Property name:SkipConfirmMessage
    Values:
    Any String message.
    Default value is “Skipping this video will earn you NO rewards. Are you sure?”.
  7. Affirmative label for skip dialog
    Defines what should be the label for affirmative button in skip dialog.
    Property name:SkipConfirmYesLabel
    Values:
    Any String message.
    Default value is “Yes”.
  8. Negative label for skip dialog
    Defines what should be the label for affirmative button in skip dialog.
    Property name:SkipConfirmNoLabel
    Values:
    Any String message.
    Default value is “No”.
  9. Skip timer message
    Defines message to be shown before enabling skip button. Don’t forget to add placeholder “ ## ” in your custom message.
    This placeholder is replaced by property “Default skip time” assigned above.
    Property name:SkipTimerMessage
    Values:
    Any String message.
    Default value is “You can skip video in ## seconds”
  10. Incentive message
    Defines message to be shown during video progress, that after what time user will be incentivised.
    Property name:IncentiveMessage
    Values:
    Any String message
    Default value is “more seconds only for your reward !”
  11. Should collect feedback
    Defines message to be shown during video progress, that after what time user will be incentivised.
    Property name:setShouldCollectFeedback
    Values:
    True = If you want to collect feedback from the user for the Ad.
    False = If you don’t want to collect feedback from the user for the Ad.
  12. Audio Enabled
    Provides a medium to disable audio for video ad without user interaction.
    Property name:IsAudioEnabled
    Values:
    True = If you want to play audio for video ad.
    False = If you don’t want to play audio for video ad.

User Details

For better targeting of ads you can also provide user details to our SDK using.

PokktUserDetails pokktUserDetails = new PokktUserDetails();
pokktUserDetails.Name = "";
pokktUserDetails.Age = "";
pokktUserDetails.Sex = "";
pokktUserDetails.MobileNo = "";
pokktUserDetails.EmailAddress = "";
pokktUserDetails.Location = "";
pokktUserDetails.Birthday = "";
pokktUserDetails.MaritalStatus = "";
pokktUserDetails.FacebookId = "";
pokktUserDetails.TwitterHandle = "";
pokktUserDetails.Education = "";
pokktUserDetails.Nationality = "";
pokktUserDetails.Employment = "";
pokktUserDetails.MaturityRating = "";
PokktAds.SetUserDetails(pokktUserDetails);