Get Started with Avocarrot

Overview

Examples

Android

Overview

Getting Started

- Integrating Ads

Stream

Native Assets

Banner

Interstitial

Video

- Others

Troubleshooting

- Adapters

Admob Android Adapter

Mopub Android Adapter

iOS

Overview

Getting Started

- Integrating Ads

Stream

Native Assets

Banner

Interstitial

Video

- Others

Troubleshooting

- Adapters

Admob iOS Adapter

Mopub iOS Adapter

API Documentation

Reporting API

Help

Supported Networks & Ad Types

General

Earnings

Payments and Accounting

Integration

Reporting

Mediation Network Optimization

Legal and Privacy

Updates

SDK Change Log

Android Change Log

iOS Change Log

Stream

Updated 2 months ago ​by Derek Lim

Overview

This tutorial helps you setup stream ads and receive your first Avocarrot stream ad.


Prerequisites

You need an Avocarrot account to complete the tutorial. Create an account
You need to create a stream ad unit for your app on your Avocarrot dashboard.
You need to setup the Avocarrot SDK. Setup SDK

Setup Steam Ads

  1. Configure In-Feed ViewerID of advertising space for testing (like for native ad): "7f900c7d-7ce3-4190-8e93-310053e70ca2"
    “The ID above is meant for testing purpose only, please replace it with the Ad unit Id of your placement from the dashboard .

    Stream adapter is a smart technology to add native ads as items in your feeds based on UITableView or UICollectionView. Settings for stream adapter are returned from the server side and you can change it as you wish.

    #import <avocarrotnativeview avocarrotnativeview.h="">
    ...
    - (AVOTableViewStreamAdapter *_Nonnull)createStreamAdapterForTableView:(UITableView *_Nonnull)tableView
                                           parentViewController:(UIViewController *_Nonnull)viewController
                                           adUnitId:(NSString *_Nonnull)adUnitId
                                           templateType:(AVONativeAdsTemplateType)templateType
                                           templateCustomization:(void (^ _Nullable)(AVOTemplateCustomizationObject *_Nonnull templateCustomizationObject))templateCustomization;
    - (AVOCollectionViewStreamAdapter *_Nonnull)createStreamAdapterForCollectionView:(UICollectionView *_Nonnull)collectionView
                                                parentViewController:(UIViewController *_Nonnull)viewController
                                                adUnitId:(NSString *_Nonnull)adUnitId
                                                templateType:(AVONativeAdsTemplateType)templateType
                                                delegate:(id <avocollectionviewstreamadapterdelegate> _Nullable)delegate
                                                templateCustomization:(void (^ _Nullable)(AVOTemplateCustomizationObject *_Nonnull templateCustomizationObject))templateCustomization;</avocollectionviewstreamadapterdelegate></avocarrotnativeview>
    
    import AvocarrotNativeView
    ...
    func createStreamAdapter(for tableView: UITableView,
                             parentViewController viewController: UIViewController,
                             adUnitId: String,
                             templateType: AVONativeAdsTemplateType,
                             templateCustomization: ((AVOTemplateCustomizationObject) -> ())?) -> AVOTableViewStreamAdapter
    func createStreamAdapter(for tableView: UITableView,
                             parentViewController viewController: UIViewController,
                             adUnitId: String,
                             adViewClassForRendering adViewClass: AnyClass) -> AVOTableViewStreamAdapter
    
  2. Note for custom collection view layout:  If you want to know the original index path of a cell in your feed without ads use this method (it may be important to load data from your data array):

    - (NSIndexPath * _Nullable)originalIndexPath:(NSIndexPath * _Nonnull)indexPath;

    If you want to use methods of UITableView and UICollectionView which work with NSIndexPath please use UITableView (AVOStreamAdapter) and UICollectionView (AVOStreamAdapter) categories (declared in AVOTableViewStreamAdapter.h and AVOCollectionViewStreamAdapter.h). There categories contain methods with avo_ prefix which return original indexPaths.

    To process stream adapter events, you should implement blocks or subscribe to notifications. The following is available:

    MethodDescriptionNSNotificationCenter key
    - (instancetype _Nonnull)onAdsDidLoad:(nullable void (^)(void))blockCalled after ads for stream adapter have been loaded. After this event you can reload your UITableView/UICollectionView or could wait - ads will be added automatically during scrolling.kAVONotification_StreamAdapterAdsDidLoad
    - (instancetype _Nonnull)onAdsFailed:(nullable void (^)(void))blockCalled after ads for stream adapter failed to load.kAVONotification_StreamAdapterAdsFailed
    Currently stream adapter does not support dynamic modification of data source (insert, move, delete of items). This support will be added soon.

    Don’t forget to retain stream adapter by using your local variable

  3. Congratulations! Compile and Run your project . You can now customize your stream ads to match the look and feel of your app.

Advanced Customization

Go Live!

  1. Remove sandbox If you have received a sample ad then simply disable the Sandbox mode by including the following instruction in your code:
    AvocarrotSDK.testMode = NO
    You should disable Sandbox mode ONLY when you are done with the integration and you are ready to publish your app. It is against Avocarrot's policies to use live ads during development, and doing so could get your Avocarrot account banned.
  2. Publish app You are now ready to upload your app and start making money!Your app will be marked as live once a certain amount of requests has been reached (>100 requests per day). If you have submitted your app in the Google Play/ Apple Store and you can see live ads, then you have nothing to worry about. Just wait until the impressions threshold has been reached and the app will be shown as live in your dashboard as well.
  3. Update payment details   
    Login to your account and update your payment settings.

Was this article useful?