1. Home
  2. Publishers
  3. Tapsell SDK Integration Guide for GameMaker Studio

Tapsell SDK Integration Guide for GameMaker Studio

Step 1: Download Tapsell Extension

Download Tapsell extention from the following URL:

 

Step 2: Add Tapsell Plugin to your project

In GameMaker, right click on Extensions folder and select Import Extension. Then select the file downloaded in previous step.

 

Step 3: Get AppKey

Log in your Tapsell account and get a new tapsell key by creating a new application. This key is needed for using tapsell APIs.

 

Step 4: Initialize Tapsell

Use the provided app-key to initialize Tapsell SDK using the following code.

tapsell_initialize(appKey);

 

Step 5: Request ad Ad

Showing an Ad in application may be done in two ways. Caching or Streaming the video. Also you can show Ads in different zones inside your application.
To request an Ad in your application, use the following method:

tapsell_requestAd(zoneId)

In this function, zoneId argument shows the zone in which you with to show the ad. In order to use the default zone created by Tapsell, you can pass an empty string for this argument.

tapsell_requestAd("")

 

Step 6: Get Ad ID

Response of your request is delivered to Asynchronous Social Events. In the response, a ds_map is returned. The key type in the response represents the type of result. You can obtain the type using following method.

type = string(async_load[? "type"]);

Different possible values for type is given in Table 1.

 

Table 1 Possible values for type which is delivered to async load
Value Description
TAPSELL_EVENT_AD_AVAILABLE Called when an ad is available and ready to be shown. Id of this ad is stored in ds_map with adId key. You should store the returned id in order to show the ad later.
TAPSELL_EVENT_NO_AD_AVAILABLE Called when no suitable ad was found for selected zone.
TAPSELL_EVENT_ERROR Called when an error is occurred during sending request to the server.
TAPSELL_EVENT_NO_NETWORK Called when device is not connected to internet.
TAPSELL_EVENT_AD_EXPIRING Called when the ad is expired. Ads have an expiration time and when that time is passed, that ad becomes invalid and cannot be shown. In this case, you might consider requesting a new ad.

 

Step 7: Show the Ad

In order to show the ad, use the following method with the id returned in previous step. Please note that this method can be called once for each advertisement id.

tapsell_showAd(adId,disable_back,immersive_mode,rotation_mode)

The 1st argument, adId, is the id of the ad which is returned in previous step.

disable_back and immersive_mode are Boolean arguments which indicate whether the back button should be disabled while showing rewarded videos and the video should be shown in Immersive Mode.

The 4th argument, rotation_mode is used to determine the orientation of device while showing the ad. Table 2 includes valid values for this argument and description of each value.

Table 2. Accepted values for rotation_mode
Value Description
“1”
Show video in portrait orientation
“2”
Show video in landscape orientation
“3”
Unlocked screen orientation

 

Step 8: Get Results

The result of showing ad to the user is returned as an Asynchronous Social Event. The value corresponding to type key in this event is “TAPSELL_EVENT_AD_SHOW_FINISHED”. Table 3 includes the other keys and corresponding values included in ds_map.

Table 3. keys of returned ds_map and description of corresponding values
Key Description
adId
The id of shown ad
zoneId
The id of zone for which the ad was requested
completed
Either “true” or “false” (as string values) indicating whether the user has watched complete video.
rewarded
Either “true” or “false” (as string values) indicating whether the type of shown ad is rewarded.

You should give the in-app rewards (credit, coin, gem, etc.) to the user when both completed and rewarded variables in the result are true.

 

Sample Project

A sample project is located in the following repository in case more information about the SDK is needed.

 

 

لطفا نظرات خود درباره محتوای این فایل و مشکلاتی که در پیاده‌سازی SDK تپسل با آنها مواجه شدید را به ما اطلاع دهید.

Was this article helpful?

Related Articles