Advertising

Hi Folks,

Happy Sunday!

Just wondering if anyone has any idea how I could create an algorithm to take an “advert” and place it in an inline list (the ad would obviously have the same features as the list) I would have a sheet for my list and a similar sheet for ads.

This isn’t vital to my build but I was just curious if it could be done?

Tom

Firstly to display things in a single inline list you would have to have them in the same table.

Upon reading your post I have an idea like this, but be careful about the possibility of it putting too many ads in your list.

First, in your let’s say Posts sheet (where you house the normal content), create a single value column to take a random “whole row” from your Ads sheet). On top of that single value column, create 3 lookups column to take back the ad’s title, image and link.

Then, create a new Glide Table to house a column called “Random values”, you would have just 2 values on this, named Ad and Post.

Back to your Posts sheet, create another single value column pointing to the Random values above, get back a random value from that column.

Now, you have “tags” for your posts, which should be Post and which should have its spot converted to an Ad in the list.

Create 3 If Then Else columns, if Tag = Ad then Ad’s title, image & link, else Post’s title, image (and link, if any).

In the inline list, create a custom action. If Tag = Ad then open the If Then Else final link, else view details.

The single value columns’ randomly generated values will change constantly though, so beware.

4 Likes

I’ve been exploring what I like to call ‘work tables’ with a set number of rows that are dynamically filled based on other data or conditions.

This is a thought I’ve had, which has similar parts to @ThinhDinh’s idea but may have better control over where the ads show. For example, let’s say you create a table with 30 rows. The goal is to show 9 posts and then an ad. You could maybe number the first rows 0-8, a row with 999, number 9-17, a row with 999, number 18-26, and finally a last row with 999. What I think you can do is create a series of single value columns that will pull from the posts table by using those numbered columns to get the row from the posts table that is that number of rows from the end. You will also use the 999 numbered rows to create a relation and single value to get random data from the ads table. Finally you may need some IF columns to fill from either your posts or ads, so you can use those IF columns in a list.

The idea is that the work table is filled dynamically and interspersed with ads at predetermined intervals. Whenever a new post is added, then all the posts shift down on that table automatically, and the random ads will hopefully re-randomize periodically.

Another possible simpler idea is to keep a count of posts. Whenever that count is divisible by 10, for example, then an action will fire when the post is added to also write a row for an ad or an ad placeholder row. Then maybe follow some is the same logic as above, but without the need for a ‘work table’

5 Likes

Could you possibly include Ads in the same table as Posts, with the Labels called “Post” and “Ad” and then just sort the Inline List Randomly? You then display the Tag on each image so it will display “Ad”.

Of course, you’d have zero control on where the ad or ads are placed, meaning 2 could appear right next to each other, etc. Also randomly means ALL your posts are random vs in a specific order, so that depends on how you want to display your content too.

2 Likes