In Feed

Scenario

  • Insert Ad into UITableView while users are scrolling it.

Ad Formats Supported

  • Card Ad

  • Native Ad

How to Integrate

CrystalExpress™ SDK provides CEInFeedHelper to simplify in-feed integration of Card Ad and Native Ad. Please follow the step below:

Step 0 : Put CEInFeedHelper folder into your project folder

Please put the whole folder of CEInFeedHelper from CrystalExpress SDK Sample code provided into the folder of your App project.

Step 1: Create appropriate CEInFeedHelper for your scenario

There are 2 ways to integrate CEInFeedHelper, placement integration and tag integration. Main difference between those 2 integrations is that tag integration is aimed to handle Ad targeting for specific channels.

Under placement integration, publishes provide the placement to helper directly. On the other hand, the helper will get placements for the tag from tag settings from our dashboard

  • Placement integration of Card Ad format:

  • Placement integration of Native Ad format:

  • Tag integration of Card Ad format:

  • Tag integration of Native Ad format:

Step 1-2(Native Only): Implement Native Ad Source Delegate

You can set Native Ad layout properly by implementing this delegate. Moreover, the frame of this view returned will be the same as the ad view received from the helper, so it would be better to set the width of Ad view equal to table view.

Step 2: Create CEDataSourceHelper by CEInFeedHelper

CEDataSourceHelper can help you know adjusted position and related info of Ad items on the tableview.

Step 3: Add the Ad count into numberOfRowsInSection

Add the number of Ad items by CEDataSourceHelper into numberOfRowsInSection.

Step 4: Get Ad view from CEDataSourceHelper

Case: Ad is not going to show right away

  • Get Ad view from CEDataSourceHelper by the index number you assign and get original data's height with shifted path in estimatedHeightForRowAt.

Case: Ad is going to show right away

  • Get Ad view from CEDataSourceHelper by the index number you assign and get original data's height with shifted path in cellForRowAt.

  • Get Ad view from CEDataSourceHelper by the index number you assign and get original data's height with shifted path in heightForRowAt .

Step 5: Get original data's height with shifted path

Step 6: Insert new rows for just new Ads

Update the Ad count to maintain data integrity and avoid exception of UITableView.

Step 7: Implement delegate of CEInFeedHelper (Optional *)

By implementing delegate, you can get Ad event callback from Ad source.

Last updated