Giter VIP home page Giter VIP logo

gd-html5's Introduction

npm GitHub version license

Gamedistribution.com HTML5 SDK

This is the documentation of the "GameDistribution.com HTML5 SDK" project.

Gamedistribution.com is the biggest broker of high quality, cross-platform games. We connect the best game developers to the biggest publishers.

Running into any issues? Check out the F.A.Q. within the Wiki of the github repository before mailing to [email protected]

Implementation within games

The SDK should be integrated within HTML5 games by loading it through our CDN. Specific information of the SDK features and usages can be found at the wiki.

Implementation self-hosted games.

In the case where a developer wants to self-host their game; the SDK should be implemented within the game as aforementioned. The only difference is that they will have to upload a zipped index.html-file containing an iframe with the following query variable: GD_SDK_REFERRER_URL. The value of this variable should be the parentUrl. A perfect example can be found at ./index_iframe.html.

Debugging

Games, which include the SDK, can be easily debugged by calling the following from a browser developer console:

gdsdk.openConsole();

The gdsdk namespace is set when creating the SDK instance. We can't change the name of this namespace as it is still used within games using the old SDK implementation.

Repository

The SDK is maintained on a public github repository. https://github.com/gamedistribution/GD-HTML5

Deployment

Deployment of the SDK to production environments is done through TeamCity.

Installation for development

Install the following programs:

Pull in the rest of the requirements using npm:

npm install

Setup a local node server, watch changes and update your browser view automatically:

grunt

Make a production build:

grunt build

Make a production build of the promotion script. This script is loaded through advertisement slots to support for cross promotions:

grunt promo

Events

SDK EVENTS

The SDK events should be used by developers to start or pause their game or handling critical errors. Unless the errors are ad related, then they could hook into the AD_ERROR event, however; the SDK should gracefully fail, so this should not be needed.

Event Description
SDK_READY When the SDK is ready.
SDK_ERROR When the SDK has hit a critical error.
SDK_GAME_START When the game should start.
SDK_GAME_PAUSE When the game should pause.
SDK_GDPR_TRACKING When the publishers' client has requested to not track his/ her data. Hook into this event to find out if you can record client tracking data.
SDK_GDPR_TARGETING When the publishers' client has requested to not get personalised advertisements. Hook into this event to find out if you can display personalised advertisements in case you use another ad solution.
SDK_GDPR_THIRD_PARTY When the publishers' client has requested to not load third party services. Hook into this event to find out if you can third party services like Facebook, AddThis, and such alike.

IMA SDK EVENTS

The SDK events are custom ads for handling any thing related to the IMA SDK itself.

Event Description
AD_SDK_MANAGER_READY When the adsManager instance is ready with ads.
AD_SDK_CANCELED When the ad is cancelled or stopped because its done running an ad.

AD EVENTS

The Gamedistribution.com SDK uses the IMA SDK for loading ads. All events of this SDK are also available to the developer. https://developers.google.com/interactive-media-ads/docs/sdks/html5/

Event Description
AD_ERROR When the ad it self has an error.
AD_BREAK_READY Fired when an ad rule or a VMAP ad break would have played if autoPlayAdBreaks is false.
AD_METADATA Fired when an ads list is loaded.
ALL_ADS_COMPLETED Fired when the ads manager is done playing all the ads.
CLICK Fired when the ad is clicked.
COMPLETE Fired when the ad completes playing.
CONTENT_PAUSE_REQUESTED Fired when content should be paused. This usually happens right before an ad is about to cover the content.
CONTENT_RESUME_REQUESTED Fired when content should be resumed. This usually happens when an ad finishes or collapses.
DURATION_CHANGE Fired when the ad's duration changes.
FIRST_QUARTILE Fired when the ad playhead crosses first quartile.
IMPRESSION Fired when the impression URL has been pinged.
INTERACTION Fired when an ad triggers the interaction callback. Ad interactions contain an interaction ID string in the ad data.
LINEAR_CHANGED Fired when the displayed ad changes from linear to nonlinear, or vice versa.
LOADED Fired when ad data is available.
LOG Fired when a non-fatal error is encountered. The user need not take any action since the SDK will continue with the same or next ad playback depending on the error situation.
MIDPOINT Fired when the ad playhead crosses midpoint.
PAUSED Fired when the ad is paused.
RESUMED Fired when the ad is resumed.
SKIPPABLE_STATE_CHANGED Fired when the displayed ads skippable state is changed.
SKIPPED Fired when the ad is skipped by the user.
STARTED Fired when the ad starts playing.
THIRD_QUARTILE Fired when the ad playhead crosses third quartile.
USER_CLOSE Fired when the ad is closed by the user.
VOLUME_CHANGED Fired when the ad volume has changed.
VOLUME_MUTED Fired when the ad volume has been muted.

gd-html5's People

Contributors

alatella87 avatar demiremrece avatar florisdh avatar gboyraz avatar gboyrazr avatar gehaktmolen avatar jbartek25 avatar serdar986 avatar serdarakay avatar serdariks avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gd-html5's Issues

Is it recommended to use AdType or a raw string?

The Display Ads documentation shows the use of AdType.Display constant:

gdsdk.showAd(window.gdsdk.AdType.Display, { containerId: "CONTAINER_ID_TO_PUT_AD_IN"});

The Rewarded Ads documentation on the other shows the use of the "rewarded" string:

gdsdk.showAd('rewarded');

When checking the minified code it seems like AdType contains constants also for Rewarded and Interstitial ads. So which is recommended to use? The AdType constant or string?

Bag in wiki

https://github.com/GameDistribution/GD-HTML5/wiki/SDK-Implementation

bag:

nextButton.addEventListener('mouseUp', function () {
    if (typeof gdsdk !== 'undefined' && gdsdk.showBanner !== 'undefined') {
         gdsdk.showBanner();
    }
});

good:

nextButton.addEventListener('mouseUp', function () {
    if (typeof gdsdk !== 'undefined' && gdsdk.showBanner !== undefined) {
         gdsdk.showBanner();
    }
});

very good:

nextButton.addEventListener('mouseUp', function () {
    if (typeof gdsdk !== 'undefined' && gdsdk.showBanner) {
         gdsdk.showBanner();
    }
});

perfect:

nextButton.addEventListener('mouseUp', function () {
    window.gdsdk && gdsdk.showBanner && gdsdk.showBanner();
});

Google Funding Choices Conflict

Hello,

I tested Google Funding Choices GDRP/CCPA implementation on one of my sites, and it seems that there is a conflict between GD and Google Funding Choices.

Where I have games from GD, the game won't load - it will appear the splash screen, but when I hit the "Play" button, nothing will happen. You can see the problem here: https://www.gameszap.com/game/12741/fireboy-and-watergirl-5-elements.html

Other games work fine.

Do you know how can we solve this? From what I can see, is a problem on the GD side with collecting user consent.

Anybody (publishers) had the same problem? Thank you.

error

Which URL to load the SDK from CDN, please?

In the documentation on the project homepage at https://github.com/GameDistribution/GD-HTML5 you state that the SDK should be loaded from your CDN.

However, nowhere can I find a current URL from which the SDK should be loaded. The only URL I have seen is the one at the top of this document, which you have indicated is for a legacy version of the SDK and should not be used going forward:

https://github.com/GameDistribution/GD-HTML5/wiki/SDK-Implementation

The additional documentation on the homepage seems like it's only relevant if I wish to host the SDK directly within the game distributable:

https://github.com/GameDistribution/GD-HTML5

At the moment I don't have any opinion on whether self-hosting is the best option or not so, for now, would prefer to go down the CDN route because it seems like it should be simpler to implement. Can you therefore advise as to the correct SDK URL, please?

Thanks!

Need exemple project with GD SDK for Cosntruct 3 engine

Hello guys. I tried to integrate your plugin for Constuct 3 but it doesn't work properly. Could you please provide an example project - source code for C3 in format .c3p included condition and action exemple - show ads, rewarded, preload and etc. which will clarify the situation for me and many other users of your platform, thank you!

`showAd()` promise never resolves

It seems to work fine when an ad is shown. But when an ad error occurs it keeps unresolved forever.
An easy way to reproduce this is to load the sdk on localhost.

How to show Display/banner ads?

The documentation/wiki mentions that gdsdk.showBanner() is deprecated in favor of gdsdk.showAd().

Further down, there is documentation for Display Ads which are shown using

gdsdk.showAd(window.gdsdk.AdType.Display, { containerId: "CONTAINER_ID_TO_PUT_AD_IN"});

I assume this is the replacement for the deprecated gdsdk.showBanner() function?

I created an html <div> element with size 728x90

<div id="canvas-ad" width="728" height="90"/>

But when testing I see in the console the following error:

gameDistributionV1.3.min.js:2 No fitting size found for slot 'gd__banner@canvas-ad' with max ad size 0x0

Is there a full example of how to create a div and show a Display Ad somewhere?

Ads not showing on localhost

I tried setting advertisementSettings.debug to true, calling gdsdk.openConsole() and changing my hosts file. But ads are never showing. It just logs a whole bunch of errors in the console.

Incorrect Error constructor

The Error constructor parameter is incorrect here:

throw new Error("Unsupported an advertisement type: ", adType);

According to MDN the second parameter for the Error constructor is an optional filename: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error/Error

I think the line should say:

throw new Error("Unsupported an advertisement type: " + adType);

It seems that in other places of the code (like preloadAd) it is correct (although to be precise it's missing the whitespace after the colon):

throw new Error("Unsupported an advertisement type:" + adType);

Calling `gdsdk.openConsole()` multiple times makes buttons unresponsive.

When you call gdsdk.openConsole() when it is already open, it opens a duplicate console for which the buttons don't do anything.

I'd like to automatically call gdsdk.openConsole() after initialization so that new developers automatically get the debug buttons in development builds. But since it automatically opens when you refresh the page, you'll end up with broken buttons when doing this.

main.min.js is broken?

I get always this error on my game, or every other game on the GameDistribution Plattform. I think the problem is on main.js!

[0.124s] gdsdk AD_SDK_ERROR ReferenceError: google is not defined at s.value (main.min.js:8) at main.min.js:8

How to check ads timeout (avoid "too soo" warning)?

Hello,

Sometimes when I call gdsdk.showAd I get a warning:

The advertisement was requested too soon

It is fine and I understand why it happens. But my question is - is there any way to check if the ad is ready before I call gdsdk.showAd method?

Before this call, I pause the game, mute the sound, and show my own ad overlay. And when the ad is complete I resume the game, unmute the sound and hide ad overlay.

It looks fine when the ad actually displays. But if it is not ready (too soon) then overlay flashes for a fraction of a second, sound suddenly abrupts, and then resumes. It looks like some kind of a glitch and ruins the player experience.

I would like to avoid it and don't try to show an ad if it is not ready yet.

Thanks in advance!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.