Меню

Проект

Интегриране на SDK - монетизация за Html5 игра

Търся специалист в хтмл5 и js

Трябва ми програмист, който да интегрира SDK кодове в индекс файла и да добави команди за показване на рекламата в game.js файла.

Изискванията са следните:

GamePix Game SDK Integration Process


The GamePix game SDK provides a series of utility methods needed for running your game in the GamePix ecosystem.


They enhance the user experience of your game and complete the integration with our ads network and revenues system.


Before you start integrating the SDK methods inside your Game, here are a few things to check:


Keep the final size of your Game the smallest possible.

Don't use external resources; all the assets in your Game must have a relative path.

Don't use third-party analytics. GamePix will provide metrics for your Game.

Don't open external links.

Don't use "window.alert" or "window.confirm".

When the user switches to a new browser tab, game must pause (including audio).

Mandatory steps


1: Import the SDK inside your index.html MANDATORY

Import the SDK as first script in the <head> section.


<head>

 <script src="https://integration.gamepix.com/sdk/v3/gamepix.sdk.js"></script>

...

</head>

Utility Methods


2: GamePix.localStorage


Use GamePix.localstorage methods to save progress in your Game. Use GamePix.localStorage interface through getItem, setItem and removeItem. Consider that your game will be played inside an iframe, so in some mobile browsers, when the user closes the application or a week has passed, the localStorage will be purged, due to a third party policy restriction. We are working hard on overcoming this restriction with a global storage mechanism that will save in cloud users' progress. When this mechanism will be available, it will be integrated in GamePix.localStorage methods.


// GamePix.localStorage.setItem(key, value);

// @param: {String} key

// @param: {String} value

// returns: {Object}

// example:


GamePix.localStorage.setItem(`mySuperProperty`, `1`);


// Messages:

// Error: KEY_OR_VALUE_FOR_LOCALSTORAGE_NOT_A_STRING


/*-------------------------------------------------------*/


// GamePix.localStorage.getItem(key);

// @param: {String} key

// returns: {String || null}

// example:


GamePix.localStorage.getItem(`mySuperProperty`);


// Messages:

// Error: KEY_OR_VALUE_FOR_LOCALSTORAGE_NOT_A_STRING


/*-------------------------------------------------------*/


// GamePix.localStorage.removeItem(key);

// @param: {String} key

// returns: {Object}

// example:


GamePix.localStorage.removeItem(`mySuperProperty`);


// Messages:

// Error: KEY_OR_VALUE_FOR_LOCALSTORAGE_NOT_A_STRING

3: GamePix.interstitialAd().then(callback)


Not every single interstitialAd() will trigger an ad. GamePix's system will determine when a user is ready for another ad, so feel free to signal as many commercial break opportunities as possible. Remember to Pause your game before calling the interstitialAd() and to resume it in the callback.


// GamePix.interstitialAd()

// @param: none

// returns: {Promise}

// example:


// Show request for Interstitial Ad


// IMPORTANT: *** PAUSE YOUR GAME ***


GamePix.interstitialAd().then(function (res) {


    // IMPORTANT: *** RESUME YOUR GAME ***


    if (res.success) {

      // Log the success if you want

      info();

    } else {

      // Log the error if you want

      errorInfo();

    }

  });


// Messages:

// Error: GAMEPIX_LOADED_NOT_CALLED

// Error: INTERSTITIAL_AD_CALLED_TWICE

4: GamePix.rewardAd().then(callback)


This function will ask the SDK to show a Reward Ad. This method waits for the reward ad to be displayed and then returns res.success = true if the user has watched it, or false if a reward ad is not available or the user has not watched it.GamePix rewarded ads are still in beta, the fill rate depends on countries and device settings.In test environment, you will receive a res.success = true 50% of the time.


// GamePix.rewardAd()

// @param: none

// returns: {Promise}

// example:


// Show request for Reward Ad

GamePix.rewardAd().then(function (res) {

    if (res.success) {

      assignReward();

    } else {

      denyReward();

    }

  });


// Messages:

// Error: GAMEPIX_LOADED_NOT_CALLED

// Error: REWARD_AD_CALLED_TWICE

5: GamePix.updateScore(value)


Call this function every time there's a score update inside the Game. The function accepts numbers only.


// GamePix.updateScore(currentScore)

// @param: {Number} currentScore

// returns: {Number}

// example:


// Player scores 9000!!!!!

let currentScore = 9000;

GamePix.updateScore(currentScore);


// Messages:

// Error: GAMEPIX_LOADED_NOT_CALLED

// Error: UPDATE_SCORE_VALUE_IS_NOT_A_NUMBER

6: GamePix.updateLevel(value)


Call this function every time the user gets to a new level. The function accepts numbers only.


// GamePix.updateLevel(currentLevel)

// @param: {Number} currentLevel

// returns: {Number}

// example:


// Player reaches level 10

let currentLevel = 10

GamePix.updateLevel(currentLevel);


// Messages:

// Error: GAMEPIX_LOADED_NOT_CALLED

// Error: UPDATE_LEVEL_VALUE_IS_NOT_A_NUMBER

7: GamePix.lang()


If your Game has multiple languages (and you want to know it before the Game's loaded in order to switch your Game language for the user), you can check the current player language using GamePix.lang(). Otherwise the Game should default to English.


// GamePix.lang()

// @param: none

// returns: String (enum: ['ar','zh','nl','en','fr','de','it','ja','ko','pl','pt','ru','es','tr'])

// example:


const lang = GamePix.lang();

console.log('lang:', lang) // => "lang: en"

8: GamePix.happyMoment()


Send to the SDK if a particular "Happy Moment" just happened in your Game. It could be the unlocking of a special item, or triggering a cool event in the Game.


// GamePix.happyMoment()

// @param: none

// returns: null

// example:


// Player wins a tournament or unlock something

GamePix.happyMoment()

Advanced


Messages


The following messages are the responses SDK returns in case of problems:



  GAMEPIX_PLAYER_NOT_FOUND: "GamePix Player Not Found."


  GAMEPIX_LOADED_NOT_CALLED: "GamePix.loaded() is not called.

  Please use it before any other GamePix SDK methods"


  UPDATE_SCORE_VALUE_IS_NOT_A_NUMBER: "The value provided inside GamePix.updateScore function is not a number!

  Please pass to this function only integer positive numbers."


  UPDATE_LEVEL_VALUE_IS_NOT_A_NUMBER: "The value provided inside GamePix.updateScore function is not a number!

  Please pass to this function only integer positive numbers."


  LOADING_VALUE_IS_NOT_A_NUMBER: "The value provided inside GamePix.loading function is not a number!

  Please pass to this function only integer positive numbers between 0 and 100."


  LOADED_ALREADY_CALLED: "GamePix.loaded() can be called only one time and has been already called!"


  INTERSTITIAL_AD_CALLED_TWICE: "Interstitial ad has been called more than one time before it was completed"


  REWARD_AD_CALLED_TWICE: "Reward ad has been called more than one time before it was completed"


  KEY_OR_VALUE_FOR_LOCALSTORAGE_NOT_A_STRING: "key or value passed to GamePix.localStorage is not a stri

  • Затворен
  • Бюджет 100лв.

Кандидати // 1

Свиване
  • Кандидат
  • АРТ И СТ     Аз принципно много повече харча отколкото ми давате ама светът около мен е нереален. Моят свят е истински за 100 лева за 10 минути ще го направя.
    1. Aктивност:
    2. 40%
    40%
  • 1 дни
  • 100 лв.




Качете вашия банер тук