LogoLogo
Go to Airflux
  • Welcome to Airflux
  • Airflux Onboarding
    • Airflux Integration
      • 1. Add your app to the dashboard
      • 2. Install the Airflux SDK
      • 3. Send in-game event data
      • 4. Call the Inference API
  • Reporting
  • Airflux Reference
    • How inference works
    • Required event data for Airflux integration
    • Preparing for the App Store Review
    • Unity SDK Reference
Powered by GitBook

Links

  • Need help? Contact Support
  • Question? Contact Sales
On this page
  • 1. Call the Inference API and configure callbacks
  • Frequently Asked Questions
  • 2. Verify implementation
  • 3. Deploy the app
  • Next steps
  1. Airflux Onboarding
  2. Airflux Integration

4. Call the Inference API

Previous3. Send in-game event dataNextReporting

Last updated 8 days ago

Configure the Airflux SDK to call the Inference API before displaying ads, and use the API response to determine whether to proceed with the ad display. This step may take about 15 minutes to 1 hour.


1. Call the Inference API and configure callbacks

Airflux analyzes player behavior using in-game events and player attribute data to determine the optimal timing for ad displays to maximize revenue. When calling the Inference API before showing an ad to the player, the Airflux AI will return a decision on whether to display the ad or skip it.

The InferenceShowAdInterstitial() function should be called when the ad is supposed to be shown.

If the API call is successfully processed, the onShowAd callback function is triggered to show the ad to the player, or the onSkipAd callback function is triggered to skip the ad for the player.

Airflux.InferenceShowAdInterstitial(
    onShowAd: () => { /* Show Ad */ },
    onSkipAd: () => { /* Skip Ad */ },
    onFailure: (AirfluxError error) => { /* Handle on failure */ }
);

When the API call fails, onFailure is returned. The API call may fail in the following cases:

  • The device's country is not in the countryAllowlist: API calls may fail for players in countries not supported by Airflux.

  • The inference server returns a 4XX or 5XX error response: API calls may fail due to internal server errors or invalid requests.

  • The API call times out after 3 seconds without a response: Network delays or other issues may cause the API response time to go beyond the limit.

Failure to call the InferenceShowAdInterstitial() function may lead to degraded play experience and loss of ad revenue. Therefore, it is recommended that a 3-second timeout be set and a fallback be implemented to display ads to the player in case the API call fails, to minimize potential negative effects. Retry attempts upon function call failure are not required.

Frequently Asked Questions

What is the difference between onSkipAd() and onFailure() callbacks?
  • The onSkipAd() callback function is triggered when the API call is successful, and the inference result from the Airflux AI model indicates that an ad should not be displayed to enhance the play experience and maximize ad revenue.

  • The onFailure() callback function is triggered when the API call fails. This includes situations such as the device's country not being in the allowlist (countryAllowlist), network issues, server errors, or request validation failures, where no response is received.

What is the response time of the API by country?

Airflux aims to deliver reliable service to users worldwide and typically maintains quick response times in most regions. However, minor delays may arise based on the network environment.

2. Verify implementation

To confirm proper implementation, review the items below.

  • Ensure that the InferenceShowAdInterstitial() function is called when the ad is supposed to be shown to the player, and verify that the logic for proceeding with ad display based on the API response is properly implemented.

  • In the test environment, confirm that when the onShowAd callback is triggered, the ad is displayed, and when the onSkipAd callback is triggered, the ad is skipped.

  • Test various failure scenarios for API calls (e.g., country restrictions, server errors, timeouts, etc.) to ensure the onFailure callback is invoked correctly, and fallback procedures operate as intended.

3. Deploy the app

After sufficient QA and app crash testing, deploy your gaming app.

Where can I get guidance for the app store review?

Next steps

Click for guidance on preparing for the Google Play and App Store reviews.

Congratulations! If you have completed the steps above, you are all set to optimize your in-game advertising with Airflux. Click to learn how to receive your optimization results.

here
here