0.5.6 • Published 4 months ago

react-native-audienzz v0.5.6

Weekly downloads
-
License
MIT
Repository
github
Last release
4 months ago

React Native Audienzz Library (AppNexus)

React Native implementation of the AppNexus SDK (TypeScript).

Installation

yarn add react-native-audienzz

(cd ios && pod install)

You don't have to manually link this library as it supports React Native auto-linking.

Usage

There are 2 types of ads implemented in the library: AppNexusBanner and AppNexusVideoBanner. Even though Banner ads may show videos as well (allowVideo property), AppNexusVideoBanner has its own separate instance.

AppNexusBanner

AppNexusBanner component is used to display banners of different sizes.

Component example:

import { AppNexusBanner } from 'react-native-audienzz';

  <AppNexusBanner
    placementId={"123456789"}
    sizes={[[300, 250]]}
    reloadOnAppStateChangeIfFailed
    autoRefreshInterval={30}
    keywords={{
      environment: 'test',
    }}
    allowVideo
    onAdLoadSuccess={() => console.log(`Loaded!`)}
    onAdLazyLoadSuccess={() => console.log(`Lazy loaded!`)}
    onAdLoadFail={() => {
      console.log(`Load failed!`);
    }}
    onAdVisibleChange={(visibilityType) => {
      console.log(`The ad visibility has changed`)
    }}
  />

AppNexusBanner props:

NameDescriptionRequiredTypeExample
placementIdThe placement ID identifies your banner in the system. You should have a valid, active placement ID to monetize your applicationYESString"1234567"
sizesAn array of banner ad sizes to requestYESArray[[300,250], [320,460]]
allowVideoEnabling Video Ads (outstream only). For the instream video ads, please refer to the AppNexusVideoBanner.Default: falseAppNexus documentation: depending on which type of creative has the highest bid, either VAST video or regular HTML banner ads will appear in the app. The mechanism for deciding which type of ad to show is handled automatically for you by the SDK.NoBooleantrue
autoRefreshIntervalThe interval (in seconds) on how often to reload the banner ad. The minimum allowed is 15, default is 30. To disable autorefresh, set to 0.NoNumber30
keywordsAdd a custom keyword to the request URL for the ad. This is used to set custom targeting parameters within the AppNexus platform. You will be given the keys and values to use by your AppNexus account representative or your ad network.NoObject{ environment: 'test' }
onAdLoadSuccessA callback triggered when the ad is loaded and placed within the view.NoFunction() => console.log("The ad has been loaded")
onAdLazyLoadSuccessA callback triggered when the ad is pre-loaded.NoFunction() => console.log("The ad is lazy loaded / preloaded")
onAdVisibleChangeA callback triggered when the visibility of the banner has been changed. Returns a visibility type (0 - if banner is not visible, 1 - if banner is partially visible, 2 - If banner is fully visibleNoFunction(visibilityType: number) => console.log("The visibility has changed")
onAdLoadFailA callback triggered when the ad request to the server has failed.NoFunction() => console.log("The ad hasn't been loaded")
reloadOnAppStateChangeIfFailedReloading ad if the app state has changed (background -> foreground). Works only if the ad is shown within the viewport and it is not loaded. Default: falseNoBooleantrue
customUserAgentFor IOS only. This parameter sets a custom UserAgent to correctly display received ad blocks.NoString""
percentVisibilityThe offset when the banner is considered visible (percentage of the entire banner view holder). Default: 50NoNumber50
openDeviceBrowserAdd this flag to open the device's native browser when the user clicks an ad. Default: falseNoBooleanfalse

AppNexusVideoBanner

AppNexusVideoBanner component is used to display video banners.

Component example:

import { AppNexusVideoBanner } from 'react-native-audienzz';

  <AppNexusVideoBanner
    placementId={"123456789"}
    sizes={[[300, 250]]}
    keywords={{
      environment: 'test',
    }}
    onAdLoadSuccess={() => console.log('The video ad has been loaded!')}
    onAdLoadFail={() => console.log('The video ad has failed to load!')}
    onAdVisibleChange={(visibilityType) => {
      console.log(`The ad visibility has changed`)
    }}
  />

AppNexusVideoBanner props:

NameDescriptionRequiredTypeExample
placementIdThe placement ID identifies your banner in the system. You should have a valid, active placement ID to monetize your applicationYESString"1234567"
sizesAn array of banner ad sizes to requestYESArray[[300,250], [320,460]]
keywordsAdd a custom keyword to the request URL for the ad. This is used to set custom targeting parameters within the AppNexus platform. You will be given the keys and values to use by your AppNexus account representative or your ad network.NoObject{ environment: 'test' }
onAdLoadSuccessA callback triggered when the ad is loaded and placed within the view.NoFunction() => console.log("The ad has been loaded")
onAdVisibleChangeA callback triggered when the visibility of the video banner has been changed. Returns a visibility type (0 - if banner is not visible, 1 - if banner is partially visible, 2 - If banner is fully visibleNoFunction(visibilityType: number) => console.log("The visibility has changed")
onAdLoadFailA callback triggered when the ad request to the server has failed.NoFunction() => console.log("The ad hasn't been loaded")
customUserAgentFor IOS only. This parameter sets a custom UserAgent to correctly display received ad blocks.NoString""
percentVisibilityThe offset when the banner is considered visible (percentage of the entire banner view holder). Default: 50NoNumber50

Changelog

Our Changelog is handled by Github releases. See all releases

0.5.6

4 months ago

0.5.5

5 months ago

0.4.5

5 months ago

0.4.2-robo

5 months ago

0.4.2-alpha

5 months ago

0.5.4

7 months ago

0.5.3

9 months ago

0.5.0

11 months ago

0.5.2

10 months ago

0.5.1

10 months ago

0.4.4

2 years ago

0.4.3

2 years ago

0.4.2

2 years ago

0.4.1

2 years ago

0.3.0

2 years ago

0.3.2

2 years ago

0.4.0

2 years ago

0.3.1

2 years ago

0.3.4

2 years ago

0.3.3

2 years ago

0.2.0

3 years ago