-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
25 changed files
with
759 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# event.data | ||
|
||
> --------------------- ------------------------------------------------------------------------------------------ | ||
> __Type__ [String][api.type.String] | ||
> __Event__ [adsRequest][plugin.chartboost.event.adsRequest] | ||
> __Revision__ [REVISION_LABEL](REVISION_URL) | ||
> __Keywords__ ads, advertising, Chartboost, adsRequest, data | ||
> __See also__ [adsRequest][plugin.chartboost.event.adsRequest] | ||
> [chartboost.*][plugin.chartboost] | ||
> --------------------- ------------------------------------------------------------------------------------------ | ||
|
||
## Overview | ||
|
||
JSON-encoded [string][api.type.String]. Provides additional context for certain event [phases][plugin.chartboost.event.adsRequest.phase] with the following properties: | ||
|
||
* `reward` ([Number][api.type.Number]) — Applies only to rewarded video ads <nobr>([event.type][plugin.chartboost.event.adsRequest.type] of `"rewardedVideo"`)</nobr> and a [phase][plugin.chartboost.event.adsRequest.phase] of `"reward"`. Indicates the reward amount to be given to the user. | ||
|
||
* `location` ([string][api.type.String]) — The advertisement location. See [here][plugin.chartboost.show#locations] for a list of valid <nobr>pre-defined</nobr> options. | ||
|
||
* `errorCode` ([string][api.type.String]) — Applies to events with a [phase][plugin.chartboost.event.adsRequest.phase] of `"failed"`. This property contains the error code. | ||
|
||
* `errorMsg` ([string][api.type.String]) — Applies to events with a [phase][plugin.chartboost.event.adsRequest.phase] of `"failed"`. This property contains the error message. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# adsRequest | ||
|
||
> --------------------- ------------------------------------------------------------------------------------------ | ||
> __Type__ [Event][api.type.Event] | ||
> __Revision__ [REVISION_LABEL](REVISION_URL) | ||
> __Keywords__ ads, advertising, Chartboost, adsRequest | ||
> __See also__ [chartboost.init()][plugin.chartboost.init] | ||
> [chartboost.*][plugin.chartboost] | ||
> --------------------- ------------------------------------------------------------------------------------------ | ||
## Overview | ||
|
||
The following event properties are passed to the listener function specified in [chartboost.init()][plugin.chartboost.init]. | ||
|
||
|
||
## Properties | ||
|
||
#### [event.isError][plugin.chartboost.event.adsRequest.isError] | ||
|
||
#### [event.name][plugin.chartboost.event.adsRequest.name] | ||
|
||
#### [event.phase][plugin.chartboost.event.adsRequest.phase] | ||
|
||
#### [event.provider][plugin.chartboost.event.adsRequest.provider] | ||
|
||
#### [event.response][plugin.chartboost.event.adsRequest.response] | ||
|
||
#### [event.data][plugin.chartboost.event.adsRequest.data] | ||
|
||
#### [event.type][plugin.chartboost.event.adsRequest.type] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# event.isError | ||
|
||
> --------------------- ------------------------------------------------------------------------------------------ | ||
> __Type__ [Boolean][api.type.Boolean] | ||
> __Event__ [adsRequest][plugin.chartboost.event.adsRequest] | ||
> __Revision__ [REVISION_LABEL](REVISION_URL) | ||
> __Keywords__ ads, advertising, Chartboost, adsRequest, isError | ||
> __See also__ [adsRequest][plugin.chartboost.event.adsRequest] | ||
> [chartboost.*][plugin.chartboost] | ||
> --------------------- ------------------------------------------------------------------------------------------ | ||
## Overview | ||
|
||
[Boolean][api.type.Boolean] value indicating whether an error occurred. If this is `true`, [event.response][plugin.chartboost.event.adsRequest.response] will be a [string][api.type.String] value stating the reason. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# event.name | ||
|
||
> --------------------- ------------------------------------------------------------------------------------------ | ||
> __Type__ [String][api.type.String] | ||
> __Event__ [adsRequest][plugin.chartboost.event.adsRequest] | ||
> __Revision__ [REVISION_LABEL](REVISION_URL) | ||
> __Keywords__ ads, advertising, Chartboost, adsRequest, name | ||
> __See also__ [adsRequest][plugin.chartboost.event.adsRequest] | ||
> [chartboost.*][plugin.chartboost] | ||
> --------------------- ------------------------------------------------------------------------------------------ | ||
## Overview | ||
|
||
The string `"adsRequest"`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# event.phase | ||
|
||
> --------------------- ------------------------------------------------------------------------------------------ | ||
> __Type__ [String][api.type.String] | ||
> __Event__ [adsRequest][plugin.chartboost.event.adsRequest] | ||
> __Revision__ [REVISION_LABEL](REVISION_URL) | ||
> __Keywords__ ads, advertising, Chartboost, adsRequest, phase | ||
> __See also__ [adsRequest][plugin.chartboost.event.adsRequest] | ||
> [chartboost.*][plugin.chartboost] | ||
> --------------------- ------------------------------------------------------------------------------------------ | ||
## Overview | ||
|
||
[String][api.type.String] value indicating the phase of the [adsRequest][plugin.chartboost.event.adsRequest] event. Possible values include: | ||
|
||
* `"init"` — Indicates that the Chartboost plugin was initialized successfully. You must wait for this event phase before trying to show/load ads. | ||
|
||
* `"displayed"` — Indicates that an ad was displayed. For this phase, [event.data][plugin.chartboost.event.adsRequest.data] is a JSON string containing the ad `location`. | ||
|
||
* `"closed"` — Indicates that an ad was closed/hidden. For this phase, [event.data][plugin.chartboost.event.adsRequest.data] is a JSON string containing the ad `location`. | ||
|
||
* `"clicked"` — Indicates that an ad was clicked/tapped. For this phase, [event.data][plugin.chartboost.event.adsRequest.data] is a JSON string containing the ad `location`. | ||
|
||
* `"loaded"` — Indicates that an ad loaded successfully. For this phase, [event.data][plugin.chartboost.event.adsRequest.data] is a JSON string containing the ad `location`. | ||
|
||
* `"failed"` — Indicates that an ad failed to load. For this phase, [event.isError][plugin.chartboost.event.adsRequest.isError] will be `true` and [event.response][plugin.chartboost.event.adsRequest.response] provides additional context on the error. For this phase, [event.data][plugin.chartboost.event.adsRequest.data] is a JSON string containing the ad `location`, `errorCode` and `errorMsg`. | ||
|
||
* `"reward"` — Applies only to rewarded video ads <nobr>([event.type][plugin.chartboost.event.adsRequest.type] of `"rewardedVideo"`)</nobr>. Indicates that a video ad was viewed to completion. For this phase, [event.data][plugin.chartboost.event.adsRequest.data] is a JSON string containing the ad `location` and `reward` amount. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# event.provider | ||
|
||
> --------------------- ------------------------------------------------------------------------------------------ | ||
> __Type__ [String][api.type.String] | ||
> __Event__ [adsRequest][plugin.chartboost.event.adsRequest] | ||
> __Revision__ [REVISION_LABEL](REVISION_URL) | ||
> __Keywords__ ads, advertising, Chartboost, adsRequest, provider | ||
> __See also__ [adsRequest][plugin.chartboost.event.adsRequest] | ||
> [chartboost.*][plugin.chartboost] | ||
> --------------------- ------------------------------------------------------------------------------------------ | ||
## Overview | ||
|
||
The string `"chartboost"`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# event.response | ||
|
||
> --------------------- ------------------------------------------------------------------------------------------ | ||
> __Type__ [String][api.type.String] | ||
> __Event__ [adsRequest][plugin.chartboost.event.adsRequest] | ||
> __Revision__ [REVISION_LABEL](REVISION_URL) | ||
> __Keywords__ ads, advertising, Chartboost, adsRequest, response | ||
> __See also__ [adsRequest][plugin.chartboost.event.adsRequest] | ||
> [chartboost.*][plugin.chartboost] | ||
> --------------------- ------------------------------------------------------------------------------------------ | ||
## Overview | ||
|
||
If an [error][plugin.chartboost.event.adsRequest.isError] occurred, a [string][api.type.String] value response stating the reason. This event property is only available if [event.phase][plugin.chartboost.event.adsRequest.phase] is `"failed"`, in which case [event.data][plugin.chartboost.event.adsRequest.data] will also provide more information. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# event.type | ||
|
||
> --------------------- ------------------------------------------------------------------------------------------ | ||
> __Type__ [String][api.type.String] | ||
> __Event__ [adsRequest][plugin.chartboost.event.adsRequest] | ||
> __Revision__ [REVISION_LABEL](REVISION_URL) | ||
> __Keywords__ ads, advertising, Chartboost, adsRequest, type | ||
> __See also__ [adsRequest][plugin.chartboost.event.adsRequest] | ||
> [chartboost.*][plugin.chartboost] | ||
> --------------------- ------------------------------------------------------------------------------------------ | ||
## Overview | ||
|
||
The type of ad that was loaded, displayed, viewed, clicked/tapped, or closed/hidden. If [event.phase][plugin.chartboost.event.adsRequest.phase] is `"failed"`, indicates the type of ad that failed to load. | ||
|
||
Possible values include `"interstitial"`, `"rewardedVideo"`, or `"moreApps"`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
# chartboost.* | ||
|
||
> --------------------- ------------------------------------------------------------------------------------------ | ||
> __Type__ [Library][api.type.library] | ||
> __Revision__ [REVISION_LABEL](REVISION_URL) | ||
> __Keywords__ ads, advertising, Chartboost | ||
> __Platforms__ Android, iOS | ||
> --------------------- ------------------------------------------------------------------------------------------ | ||
## Overview | ||
|
||
The Chartboost plugin allows developers to monetize users through [Chartboost](https://www.chartboost.com) static interstitial, video interstitial, rewarded video ads, and more. | ||
|
||
<div class="docs-tip-outer docs-tip-color-alert"> | ||
<div class="docs-tip-inner-left"> | ||
<div class="fa fa-unlock-alt" style="font-size: 36px; margin-top: 2px; margin-left: 1px;"></div> | ||
</div> | ||
<div class="docs-tip-inner-right"> | ||
|
||
The Chartboost plugin is only available to users who have purchased the [Corona Professional Bundle](https://marketplace.coronalabs.com/products/corona-pro) or the [Chartboost](https://marketplace.coronalabs.com/plugin/chartboost) plugin. This plugin lets you keep 100% of your ad revenue and allows you to manage your account/settings with Chartboost directly. | ||
|
||
</div> | ||
</div> | ||
|
||
<div class="guide-notebox-imp"> | ||
<div class="notebox-title-imp">Important</div> | ||
|
||
Check out new `hasUserConsent` init parameter to enable GDPR data collection restrictions. | ||
|
||
</div> | ||
|
||
## Registration | ||
|
||
Before you can use this plugin, you must [register](https://www.chartboost.com ) with Chartboost. | ||
|
||
|
||
## Syntax | ||
|
||
local chartboost = require( "plugin.chartboost" ) | ||
|
||
|
||
## Functions | ||
|
||
#### [chartboost.init()][plugin.chartboost.init] | ||
|
||
#### [chartboost.load()][plugin.chartboost.load] | ||
|
||
#### [chartboost.isLoaded()][plugin.chartboost.isLoaded] | ||
|
||
#### [chartboost.show()][plugin.chartboost.show] | ||
|
||
#### [chartboost.onBackPressed()][plugin.chartboost.onBackPressed] | ||
|
||
|
||
## Events | ||
|
||
#### [adsRequest][plugin.chartboost.event.adsRequest] | ||
|
||
|
||
## Project Settings | ||
|
||
To use this plugin, add an entry into the `plugins` table of `build.settings`. When added, the build server will integrate the plugin during the build phase. | ||
|
||
``````lua | ||
settings = | ||
{ | ||
plugins = | ||
{ | ||
["plugin.chartboost"] = | ||
{ | ||
publisherId = "com.coronalabs" | ||
}, | ||
}, | ||
} | ||
`````` | ||
|
||
<div class="guide-notebox-imp"> | ||
<div class="notebox-title-imp">Important</div> | ||
|
||
If you are building for Android, you should __remove__ any legacy inclusion of the `["plugin.google.play.services"]` plugin from your `build.settings`. | ||
|
||
</div> | ||
|
||
<div class="guide-notebox"> | ||
<div class="notebox-title">Note</div> | ||
|
||
For Android, the following permissions/features are automatically added when using this plugin: | ||
|
||
* `"android.permission.INTERNET"` | ||
* `"android.permission.ACCESS_NETWORK_STATE"` | ||
* `"android.permission.WRITE_EXTERNAL_STORAGE"` | ||
|
||
In addition, you can add the following optional (but recommended) permissions: | ||
|
||
* `"android.permission.ACCESS_WIFI_STATE"` — Allows the Chartboost SDK to check WiFi details and send the MAC address in the HTTP request. This will be used alongside the Android ID and/or GAID (where applicable) as the identifier for the user. | ||
|
||
* `"android.permission.READ_PHONE_STATE"` — Allows the Chartboost SDK to handle calls interrupting video playback during videos. | ||
|
||
</div> | ||
|
||
|
||
## Support | ||
|
||
* [https://answers.chartboost.com/](https://answers.chartboost.com/) | ||
* [Corona Forums](http://forums.coronalabs.com/forum/545-monetization-in-app-purchases-ads-etc/) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
# chartboost.init() | ||
|
||
> --------------------- ------------------------------------------------------------------------------------------ | ||
> __Type__ [Function][api.type.function] | ||
> __Return value__ none | ||
> __Revision__ [REVISION_LABEL](REVISION_URL) | ||
> __Keywords__ ads, advertising, Chartboost, init | ||
> __See also__ [chartboost.load()][plugin.chartboost.load] | ||
> [chartboost.show()][plugin.chartboost.show] | ||
> --------------------- ------------------------------------------------------------------------------------------ | ||
|
||
## Overview | ||
|
||
`chartboost.init()` initializes the Chartboost plugin. This call is required and must be executed before making other Chartboost calls such as [chartboost.load()][plugin.chartboost.load] or [chartboost.show()][plugin.chartboost.show]. | ||
|
||
|
||
## Syntax | ||
|
||
chartboost.init( listener, params ) | ||
|
||
##### listener ~^(required)^~ | ||
_[Listener][api.type.Listener]._ Listener function that will receive [adsRequest][plugin.chartboost.event.adsRequest] events. | ||
|
||
##### params ~^(required)^~ | ||
_[Table][api.type.Table]._ Table containing Chartboost initialization values — see the next section for details. | ||
|
||
|
||
## Parameter Reference | ||
|
||
The `params` table includes parameters for Chartboost initialization. | ||
|
||
##### appId ~^(required)^~ | ||
_[String][api.type.String]._ The App ID for your app, gathered from the Chartboost [dashboard](https://www.chartboost.com/). | ||
|
||
##### appSig ~^(required)^~ | ||
_[String][api.type.String]._ The App signature for your app, gathered from the Chartboost [dashboard](https://www.chartboost.com/). | ||
|
||
##### autoCacheAds ~^(optional)^~ | ||
_[Boolean][api.type.Boolean]._ If set to `true`, Chartboost will automatically attempt to load another ad when one has been consumed via a [chartboost.show()][plugin.chartboost.show] call. When `false`, it's your responsibility to manage loading behavior. Default is `false`. | ||
|
||
##### customId ~^(optional)^~ | ||
_[String][api.type.String]._ Use this to set a custom identifier that can be used to group information in the Chartboost dashboard. | ||
|
||
##### hasUserConsent ~^(optional)^~ | ||
_[Boolean][api.type.Boolean]._ If set to `false`, Chartboost will enable GDPR data collection restrictions, set to `true` for opposite. Default is `false`. | ||
|
||
<div class="guide-notebox"> | ||
<div class="notebox-title">Note</div> | ||
|
||
For developers migrating from the Corona Ads incarnation of the Chartboost plugin, the following parameters have been __removed__ from this new plugin: | ||
|
||
* `apiKey`; replaced by `appId` and `appSig` | ||
* `testMode`; this is now set per-app in the Chartboost dashboard | ||
* `appOrientation`; this is now set per-app in the Chartboost dashboard | ||
|
||
</div> | ||
|
||
## Example | ||
|
||
``````lua | ||
local chartboost = require( "plugin.chartboost" ) | ||
|
||
-- Chartboost listener function | ||
local function adListener( event ) | ||
|
||
if ( event.phase == "init" ) then -- Successful initialization | ||
print( event.provider ) | ||
end | ||
end | ||
|
||
-- Initialize the Chartboost plugin | ||
chartboost.init( adListener, { appId="YOUR_CHARTBOOST_APP_ID", appSig="YOUR_CHARTBOOST_APP_SIGNATURE" } ) | ||
`````` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# chartboost.isLoaded() | ||
|
||
> --------------------- ------------------------------------------------------------------------------------------ | ||
> __Type__ [Function][api.type.function] | ||
> __Return value__ [Boolean][api.type.Boolean] | ||
> __Revision__ [REVISION_LABEL](REVISION_URL) | ||
> __Keywords__ ads, advertising, Chartboost, isLoaded | ||
> __See also__ [chartboost.load()][plugin.chartboost.load] | ||
> [chartboost.show()][plugin.chartboost.show] | ||
> --------------------- ------------------------------------------------------------------------------------------ | ||
|
||
## Overview | ||
|
||
Returns whether an ad is loaded or not. | ||
|
||
## Syntax | ||
|
||
chartboost.isLoaded( adType [, namedLocation] ) | ||
|
||
##### adType ~^(required)^~ | ||
_[String][api.type.String]._ One of the following values: | ||
|
||
* `"interstitial"` | ||
* `"rewardedVideo"` | ||
* `"moreApps"` | ||
|
||
##### namedLocation ~^(optional)^~ | ||
_[String][api.type.String]._ The advertisement location. If omitted, the legacy `"Default"` location will be used. See [chartboost.show()][plugin.chartboost.show] for a list of valid <nobr>pre-defined</nobr> options. | ||
|
||
<!--- USE ANCHOR LINK ABOVE ---> | ||
|
||
|
||
## Example | ||
|
||
``````lua | ||
local chartboost = require( "plugin.chartboost" ) | ||
|
||
-- Check if default interstitial is loaded | ||
print( chartboost.isLoaded( "interstitial" ) ) | ||
`````` |
Oops, something went wrong.