@azerion/h5-azerion-branding
TypeScript icon, indicating that this package has built-in type declarations

0.13.8 • Public • Published

h5-azerion-branding

This library is a simpeler version of the Splash screen, with no attachment to Phaser. This means that there is no splash, only utilities and image URL's

Branding

The most important part of this lib, as the name suggests, is the branding part. In order to have the branding (and the utilities for that matter) work correctly, you need to preload some files first. This library can handle this framework agnostic and the only thing you have to do is the following during your game's load setup:

h5branding.Branding.preload('version-for-cachebusting');

After this there are 3 main method you'll probably use a lot and some helpers that might be used occasionally. The main 3 methods are:

// This will allow you to get the correct URL to a branding logo
h5branding.Branding.brandingLogoUrl();

// Will open a new window to a site corrosponding to the branding that's leading for the current view location
h5branding.Branding.openCampaignLink('my-game-name', h5branding.UtmTargets.more_games); 

// Should be used to check if the game allows links that escape the game, eg; walktrough buttons, logo's with links.
// h5branding.Branding.brandingLogoUrl honours this logic.
h5branding.Branding.outGoingLinksAllowed();

Apart from these there are some individual helper methods that allow you to check for individual platforms/portals:

h5branding.Branding.isInternal();    // Checks internal portal json
h5branding.Branding.isContracted();  // Checks contracted json
h5branding.Branding.isSpecial();     // Checks special json
h5branding.Branding.isAdmeen();
h5branding.Branding.isKongregate();
h5branding.Branding.isNewgrounds();
h5branding.Branding.isBild();
h5branding.Branding.isBip();
h5branding.Branding.isPlaycellApp();
h5branding.Branding.isSpil();
h5branding.Branding.isAirfi();

Utilities

The utilities part is mostly used as simple helpers for the Branding part, but also includes some tiny other pieces of code that might be helpfull.

Let's start with the domain checking, in essence these are some helper parts that will allow you to filter the domain from which the game is called from. This can either be a direct call (apps / gd / partners like yandex), or an iframe call (anyn other inclusion :D).

h5branding.Utils.getSourceSite();        // Get the site from which this game/script is loaded
h5branding.Utils.getBrandingDomain()     // Get the Branding that is tied to the current site, will return any of h5branding.BrandingDomain
h5branding.Utils.getDomain('http://test.com/foo')    // Get the domain of any URI, example returns test.com
h5branding.Utils.isTc()                  //  If it runs on internal TeamCity
h5branding.Utils.inIframe()        
h5branding.Utils.getUrlParameter('key')  // Get the value of an url parameter called 'key'        

Analytics

For the moment we have a simple google wrapper available that primarily is meant to set up two trackers (one for game, one for Fabrique) and allows you to send simple screenViews. The class itself is Called GoogleAnalytics but the lib exposes the property h5branding.google with an instance of this class.

First of all the analytics need to be setup:

h5branding.google.setup(
    'UA-436346-23', //The Analytics ID
    'My Games',     //The propery name
    'version-2'     //
);

After that you you can start sending screenviews. We use them to track a user's progress inside a game, and also to measure some KPI's

h5branding.google.sendScreenView('ScreenName');

// As a bonus you can also send Events:
h5branding.google.sendGenericEvent('Category', 'Action', 'Label');

Readme

Keywords

none

Package Sidebar

Install

npm i @azerion/h5-azerion-branding

Weekly Downloads

64

Version

0.13.8

License

MIT

Unpacked Size

2.59 MB

Total Files

100

Last publish

Collaborators

  • hulsman1986
  • alebles
  • fbrq
  • a.goemans