TPStashEvent.WatchAd

public int WatchAd(
    string player_uuid,
    string character_uuid,
    string ad_slug,
    adType ad_type,
    adPlacement placed_at,
    adStatus ad_status,
    [string placed_at_slug = null]
);

Description

WatchAd collects the data of an in-app advertisement. It needs to be called when events like ad exposure, ad play, and ad end occur during the game. It can be used for the analysis of ad-related personas.

It returns 1 for success and -1 for failure. If -1 is returned, you can see the following message in the Unity editor console in TentuPlay debug mode:

TPError||ERROR inserting table_name: exception_error_message

Parameters

Name Description Required

player_uuid

Player’s unique ID (not a character’s ID) such as Steam user ID and Google Play user ID

Required

character_uuid

Player’s character’s unique lD

If there is no character in the game or If you want to use it for the player, not a character, set character_uuid to TentuPlayKeyword._DUMMY_CHARACTER_ID_.

Required

ad_slug

Unique identifier of the ad

Required

ad_type

Ad type

public enum adType {
    Interstitial,
    Reward,
}

Required

placed_at

When to expose the advertisement

Entities
public enum adPlacement {
    Etc,
    Join,
    LoginApp,
    LoginAsCharacter,
    InAppPurchase,
    ShopPurchase,
    Trade,
    PlayQuest,
    GetBonus,
    ChangeCharacterArchetype,
    ChangeStat,
    ChangeCustomAbility,
    PlayStage,
    GetCharacter,
    GetInfrastructure,
    GetPet,
    GetToken,
    GetConsumable,
    GetMaterial,
    GetEquipment,
    GetCostume,
    GetRandomBox,
    EquipInfrastructure,
    EquipPet,
    UseToken,
    UseConsumable,
    UseMaterial,
    EquipEquipment,
    EquipCostume,
    OpenRandomBox,
    EquipSkill,
    DismissCharacter,
    DismissInfrastructure,
    DismissPet,
    DismissToken,
    DismissConsumable,
    DismissMaterial,
    DismissEquipment,
    DismissCostume,
    DismissRandomBox,
    LevelUpCharacter,
    LevelUpInfrastructure,
    LevelUpPet,
    LevelUpConsumable,
    LevelUpMaterial,
    LevelUpEquipment,
    LevelUpCostume,
    LevelUpSkill,
    Deposit,
    Withdraw,
    FinishedTutorial,
}

Required

ad_status

Status of ad exposure

public enum adStatus {
    Ready,
    Start,
    Quit,
    End
}
  • Ready: The ad is ready to be played after a cooldown ends

  • Start: The ad starts to play

  • Quit: The ad was closed while playing

  • End: The ad was watched to the end

Required

placed_at_slug

Supplemental description about when to expose the advertisement

Optional