Ads Within Repeating Group

I’d like to insert a cell with an advertisement in it for every 10 cells. Any ideas how to do something like this?

I would add the element with the advertisement in it (for example an html element that makes an api call to your preferred ad service) and place this in the repeating group. Then conditionally show the group using the modulo operator to check whether or not the cell is a multiple of ten.

1 Like

Thank you very much!

This will work if you want to display the ad as well as the original cell content or replace the cell content with the add.
It wont insert an ad cell in your repeating group.
So if you have 20 items in your repeating group, the ad will be placed in cells 10 and 20 but the real content of cells 10 and 20 may either be hidden or shown with the ad.

If what you want is to put the ad in cell 10 and 20 and display the original contents after the ad cells then this solution wont work.
This will require more work.
You will have to use a combination of the modulo idea that @ryanellman suggested and the technique in the below link to achieve that.
The basic idea will be create a new list of numbers which is n+list size where n is list size divided by 10.
So if you have a list of 20 you’re going to create a list of size 22. Two of them, cells 10 and 20 will be the ads.
Original cell 10 will now be cell 11, original cell 19 will be cell 21 and original cell 20 will be cell 22.
Then next challenge will be how to determine the content to display in each cell, both the real content and ad content.

4 Likes

No problem!

This topic was automatically closed after 70 days. New replies are no longer allowed.