npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@ad4game/phaser-a4g

v1.0.3

Published

This is a Phaser HTML5 framework plugin to integrate both Google Adx and A4G video pre-roll ads into your HTML5 games.

Downloads

6

Readme

This is a Phaser HTML5 framework plugin to integrate both Google Adx and A4G video pre-roll ads into your HTML5 games.

Why we've created it and the target audience:

  • We love games, especially the HTML5 flavour.
  • We have created this plugin to help our existing and future customers monetise their Phaser games.
  • All of our HTML5 publishers, who tried video pre-roll, generated higher revenues.
  • Why AdX and not Adsense? Adx is paid by CPM and should generate better profits.

A4G Demo usage

The game from this github repository shows how a video pre-roll ad can be integrated into HTML5 framework Phaser game. See a working demo showing a video pre-roll: http://xmmorpg.com/phaser-a4g/

Integration steps:

  • First include a4g-ad-plugin.js into your codebase.
  • Then create the A4gPlugin:
game.a4gPlugin = game.plugins.add(A4gPlugin.configure({
        zone: YOUR_ZONE_ID
    }));
  • Whenever you want to show an ad within your game just call showAd() function. Typically game developers call this function on the beginning of the game and between the levels.
game.a4gPlugin.showAd();

In order to integrate this plugin you will need YOUR_ZONE_ID. Unless you are an existing customer, please sign-up as a publisher / website at: http://www.a4g.com/#get-contacted and add a message saying that you are signing up for a Phaser HTML5 game.

Note: Adx has rigorous requirements to join. We will help you with the set-up process to make it as smooth as possible.

NPM

You can get the lates NPM from here: https://www.npmjs.com/package/@ad4game/phaser-a4g

npm install @ad4game/phaser-a4g --save-dev

A4g Phaser Plugin API

  • A4gPlugin.configure(config) creates preconfigured A4gPhaser plugin. It takes 1 parameter, configuration. Configuration is a regular JavaScript object, which can take following settings:
    • zone zone id from A4g (required)
    • adTypes array of ad types that can be displayed. Available values are ['video', 'skippablevideo', 'standardvideo', 'text', 'image'], default value is ['video'] which is equivalent to standardvideo_skippablevideo, see required params / ad_type for more info: https://support.google.com/adsense/answer/3112148
    • skipOffset number of seconds when ad can be skipped, default value is 10
    • fallbackZone zone id which could be used in case the video cannot be loaded, by default not set. In case the Adx ad will not be loaded we will load a replacement ad (usually with a lower CPM). This could be useful if Adx fills a very small percentage of requests.
    • timeout number of milliseconds which indicate ad timeout. It serve for cases if something would go wrong, default value is 35000
    • pauseGame boolean indicates if game should be paused while ad is shown, default value is true
    • unpauseGameDelay number of milliseconds to wait for unpausing game after ad is hidden (will be used only if pauseGame set to true), default value is 500
  • A4gPlugin.prototype.showAd() shows an ad
  • A4gPlugin.prototype.onAdShown Phaser.Signal would be triggered when ad shown
  • A4gPlugin.prototype.onAdComplete Phaser.Signal would be triggered when ad showing is completed
  • You can fully control the styling of the div showing the ad. Our publishers often display games in an iframe, which autoscales to 100%.

References:

  • http://phaser.io/
  • https://github.com/photonstorm/phaser