FlurryAdsAndAnalytics


Welcome to Flurry Ads and Analytics for Android, a GDPR and DDR compliant extension using the latest Flurry SDK release of 11.1.1.


When creating a new project on your Flurry dashboard please note that it can take from 24 - 48 hours for ads and analytics to function
in your app / game.
Requirements:
Gamemaker Studio 1.3x - 2.x with the Android export module
The GooglePlayServicesExtension extension
An ads account with Flurry
GMS project settings:
minimum SDK is 16
Target SDK is 26
Build tools 26.0.0
Support Library 26.0.0
There are 11 functions you can use to display ads in your game and/or send analytics from your game to your Flurry dashboard,
Also there are 2 social async events that can be sent from the extension to your game. Each is explained below:
FlurryInit(String, String, String);
2 things happen here when you init Flurry ads. First off when your player runs the game for the first time the player will be taken
to the ads privacy dashboard where they can either adjust their privacy settings (applicable to your game only) or easilly exit the
dashboard, after that the game will never ask again, but note that you should include a button in your menu that alows the player
to go to the privacy dashboard at any time.
The first argument is mandatory and is the "Game_Id" which you get when entering your app on your Flurry dashboard.
The second argument is optional, put the "name_of_your_banner_ad" you created in your Flurry dashboard, otherwise put "" if not
using banner ads.
The third argument is also optional, put the "name_of_your_interstatital_ad" you created in your Flurry dashboard, otherwise put "" if
not using interstatital ads.
GDPROpenDash();
Call this function in a menu or button press to allow the player to access his privacy dashboard for the game. When the player
closes the privacy dashboard the extension will automatically re-init with the new settings.
This function should be made available to all users of your app in a menu to comply with europe's GDPR regulations.
CollectedDataDash();
Call this function to allow the user to go to Flurry's official dashboard so they can retreive your app's collected data reports and so on. This,
like the above GDPROpenDash function, should be made available to all users of your app in a menu to comply with DDR regulations.
FlurryRewardAd(String);
You can test reward ads with no special test settings, but NOTE that we cannot test banner ads!
Call this to show an interstital reward ad, if you don't want to use the player's location put "false" as the argument, otherwise put "true"
This function should be used after checking if an ad is ready to be shown. A common example code line for this is simply:
if (FlurryFunctionsReady() == 1) {
FlurryRewardAd("false");
}
FlurryBannerAd(String, String);
You can test reward ads with no special test settings, but NOTE that we cannot test banner ads!
Call this to show a banner ad, it takes 2 non case sensitive string arguments, in the first argument Enter "true" or "false", with "false" meaning
you don't want ads to use users location.
The second argument denotes the position of the banner ad, seperate with a comma. All valid choices are as follows:
"left,top" "center,top" "right,top" "left,bottom" "center,bottom" "right,bottom"
This function should be used after checking if an ad is ready to be shown. A common example code line for this is:
if (FlurryFunctionsReady() == 1) {
FlurryBannerAd("true","left,top");
}
FlurryStopBannerAd();
Call this to remove a banner ad.
logSimpleEvent(String);
Call this whenever the player does something in your game that you want to be notified of in your Flurry analytics dashboard, no
value is returned, it is usefull for knowing that a player did something in your game. Pass the "Event_name" as the argument.
logMappedEvent(String, String);
Call this whenever the player does something in your game that you want to be notified of in your Flurry analytics dashboard,
This will send a key - value pair as a string so you can get a value of something like player level up, etc.
Pass the "Event_name" as argument 1 and "Event_values" as argument 2. You can send up to 10 values each seperated by a comma
example:
logMappedEvent("Your_Mapped_Event_Name","level,10,name,Skontz,maxHp,1000");
FlurryFunctionsReady()
Call this function in conjunction with the analytics, FlurryBannerAd and FlurryRewardAd functions to confirm the extension is initted,
The function will return 1 if initted, 0 if not initted, and it will return -1 if an unknown error occured. (such trying to use ads or analytics
if the app wasn't restarted after first run and/or permissions not accepted by the user)
GetFlurryPerms();
Call this before anything else, and after you get permissions for the first time the app is run either close the app programatically (with a timed message
alerting the user of course), or tell the user to close and reopen the app for the permissions to take effect.
In Android os 6.0 and up you have to get permissions from player to save consent strings to the device and access location for ad relavancy:
Put this in the create event of the first run object in the first run room of your game to ask for permissions BEFORE you init the extension:
GetFlurryPerms();
Then set an alarm to 15 that will init the FlurryAdsAndAnalytics extension.
another IMPORTANT NOTE is if you are not going to use access fine location permission you must delete it from the manifest by double clicking the
extension in the resource tree of GMS > android tab > permissions injection box. The extension will not ask for this permission. The reason for this is to
give you a choice for each of your apps to use or not use fine location, and google play now forbids apps to have permissions in the manifest that they
do not use.
exitTheApp();
Bug fix for GMS 1.4.1804 to allow closing the game/app programatically.
Social Async Event in Gamemaker:
Values will be returned from the extension to the social async event in GMS. IMPORTANT NOTE - ALL VALUES ARE RETURNED AS A STRING.
Here is an example of what they are, how to use them and what they mean:
Code:
    if (ds_map_find_value(async_load, "type") == "watchedad") {//returns a string containing information about ads status for either banner or interstital ads
        var adstats="";
        adstats = ds_map_find_value(async_load, "value");
        if adstats = "-1" global.appendToTexts = "User closed the ad";
        if adstats = "0" global.appendToTexts = "The ad is now displaying";
        if adstats = "1" global.appendToTexts = "User completed watching the ad";
        if adstats = "2" global.appendToTexts = "User clicked on the ad";
    }   
   
    if (ds_map_find_value(async_load, "type") == "errorstatus") {//returns a string containing an error code if ad retreival was unsuccessful
        var errorcode="";
        errorcode = ds_map_find_value(async_load, "value");
        global.appendToTexts = "An error occured:#Error code is: "+string(errorcode);
    } 
To see what the error code means go to this git hub website:
https://gist.github.com/flurrydev/92d14e136403c2ea35b4
and if you get an error you can then decide to do something. (ie: retry fetching the ad if error code is 20 meaning the ad fill rate was too low, 
disable ads if error code is 1 meaning there is no internet connection, etc...)

No comments:

Post a Comment