Vincent Ritter

< back to projects

Sublime Ads

A privacy focused ad management service for your apps, websites and others.

Sublime Ads is a platform to allow you to manage and serve your very own ads in your own apps, on your websites, or other services using a simple API, or a lightweight drop-in JS script. You are in complete control on what you want to show, and how.

Everything is in one place and is easy to manage, no need to write your own custom solution. On top, Sublime Ads is privacy conscious to you and your users. Only taps/clicks will be registered for served ads and nothing else (can also be disabled per ad). I also don't use any tracking for the web application and other things, just like the internet is supposed to be.

Launched early 2021 as an MVP product to satisfy my very own needs as a developer with multiple apps and sites.

Visit the website here.

Project posts JSON/RSS Feed...

Sublime Ads - New Edge API and super mega fast embeds.

In the last few weeks I was looking at a way to improve the API for Sublime Ads. Namely I wanted to concentrate on the most commonly used endpoints which are the "random" API and the "embed" API.

They are basically, at their core, the same thing. The only difference being that one requires an API key, and the other not.

Around 2 weeks ago I made a few changes on how I'm handling "usage" on Sublime Ads which basically limits the free accounts to a certain amount of API calls. Calling the API would, each time, check if you are within the usage allowance (plus some other bits).

I tidied this up and managed to move it further up the code, so that I would only have to call one piece of code once (to check if the API key is valid and if the call is within the usage allowance)... instead of doing it three times for different parts. This dramatically improved speed by around 100ms in production... and yes... I know... dramatic. The joys of learning and improving!

However, I was still not happy about it. Whilst the API (embed & random) was super quick near my servers, it quickly became slow anywhere outside of the region. Yes, it is still quite fast, and I think most people wouldn't care, but it wasn't enough for me.

On top of that, I had a 20 minute outage this past week... rudely it happened as I was getting up for our morning routine for school. This was my first major outage. There was a minor one earlier this year, but it was DNS related - and I can't do anything about that.

Granted this was not a lot... but that was 20 minutes that also could have affected everyone else relying on the API endpoints.

This got me thinking that I need to work on some sort of backup plan, perhaps have a fallback server with a load balancer in front to distribute as needed... or in my case I could use Cloudflare's Load Balancing option also (as I am using them already for DNS and other things like static pages).

Over the past few months I got interested in their Workers offering... which basically gives me on edge computing without having to own servers, nor worry about having multiple servers dotted across the globe. This is called "serverless" if anyone is interested.

But it was all a little over my head, and I couldn't invest any time in looking into it. So instead, I continued to work on the Teams feature, which I teased and also shipped a few extra bits and bobs.

Anyway... the 20 minute downtime...

I sat down and started working on something with Workers and I was immediately sold! Not only was it super easy to develop with (it's just Javascript) but it was also immensely fast and reliable. On top of that, I had an option for edge storage too... which means every request was fast around the globe.

A few days later, and a lot of tweaking, I rewrote the embed and random API to use the edge network.

The results are mind-blowing for me...

Here is the normal embed API endpoint, with an average 430ms response time. This was around 600ms a few days before (before my API tweaks above).

As you can see, it's pretty fast close to home... but anywhere outside of that it gets pretty slow... quickly. Southern hemisphere (you know who you are) is really at a loss with nearly 1 second to get a response. This is not great.

Now let's compare the same thing, but using the edge API.

🤯

As you can see, we're getting a similar response times across the globe just like at home. Yes, the east few check servers still have slightly higher response times, but they are heaps better!

I couldn't be happier with the result!

To be honest, I was super close of not even looking at this solution, and rather concentrate on provisioning a new server, but I am glad I did!

Whilst I don't want to go into a more in-depth take on this, in this post, I do want to share how it gets enabled for embeds.

Embeds on edge

All accounts will be able to use the edge API simply by just using the embed script on their site... which means everything is working with the new edge locations as we speak. You don't need to enable it. It's an automatic process.

When you first request an embed on your site, it will check with the Sublime Ads server and return an ad for you (to display on your website). This request will have some small latency attached (but nothing more than what you've been used to already).

What happens next is that Sublime Ads will enable your edge updates and pass the relevant data to the edge location storage... we do it after the initial request because I want to make sure you're actually using it. This all happens in the background and you don't have to do anything extra. In fact, if you're using embeds right now... I know that you're already using the edge locations 😋

During testing I found that it takes around 5 - 60 seconds for edge data to become available/update. So please bear with it initially if it's your first time.

In addition to that, all updates, new ads or categories, all trigger an update to the edge. This also works for scheduled ads and works as before.

Again, you have to make zero changes to enable this. The embed script has been updated to use the new url (which actually is near identical to what it was - thank you Cloudflare - I'll write about how that works in the coming week).

So... to recap...

Embeds are super fast now! Not "scary" fast, but super duper mega fast.

Oh... and if there is downtime on the main server... they'll keep working regardless.

Embed images

With everything so fast, I saw that images were not cached... so they took some time to load. No more! They are now cached so they load extra fast across Cloudflare's network.

I'm hoping for more improvements for images over the coming months.

What about the API?

Ah yes, with the above I have been working on a new API to replace the current one for some parts of it.

I'll announce more soon, but for now we already have embeds sorted and there will also be updates to the "random" API that you're used to. In fact, it's already working in my dev environment but not quite ready for production.

I don't want to migrate the full API over to using Cloudflare Workers... I'd rather have some highly available things like embeds running through there. So this is a happy balance for me.

I'll be updating the documentation soon.

Conclusion

I'm super happy with where it's at now and I can see myself relying much more on "serverless" down the line for many other things.

For now I am happy to have done this to provide the best possible reliability and service for everyone using Sublime Ads.

More posts soon about this very topic and hope to have a few more features before the end of year.

I’ve been working on an "edge" API for Sublime Ads over the past few days, using Cloudflare Workers. Happy so far with how it’s going.

As an example, the random API response times are around 400ms currently:

Compare that to the "Edge" of around 190ms.

🤤

Not ready yet, but have been making good progress with the team functionality for Sublime Ads.

This shows when it’s enabled and you have an account selected that isn’t yours.

Spent the morning to try and figure out if I can get custom domains to work with Sublime Ads… and it works 🥳. Happy with that. More a "enterprise" thing once it rolls out. Limited to my Gluon account for now (for promoted content).

Made a few tweaks to the date picker on Sublime Ads this evening/night.

I’ll probably redesign it at some stage and also add a custom date picker (where you can choose the dates).

Happy with this though.

This morning, I have added the ability to filter your ads, on Sublime Ads, by their status. Find it on your ads overview screen. Real simple and effective. It will also remember what you last set.

Oh don’t mind me @maique


Sublime Ads - Schedule an ad

Ah yes, if there was only a way you could schedule your ads on Sublime Ads. Now that would be super nice. Wouldn't it?

Well... wait no more... because it's here! 🥳

Scheduling

When you create, or edit, an ad you now have the option to schedule them to your needs. Or, optionally, you can ignore it...

Now you have an option to add a start and/or end date, however you like it:

This is extremely useful if you want an ad to run at specific times, for example for a paid sponsorship that only lasts 1 week or a month, or whatever else.

There are a few options for you, so you don't have to worry about setting both a start and end date. It's really up to you.

You can set a start date, with no end date, which will start displaying the ad on that day. Or vice versa with an end date, where it will stop showing on that date.

You can also just leave it blank, to have an always running ad... just like you're used to.

If your ad is scheduled you now also see this in your ad list, by using new status messages, here they are:

As you can see there is a little timer icon next to the status message. That means a schedule has been set.

To get a quick overview of your start and end dates, you can click on the label to see more info:

And it's as easy as that.

API tweaks

Going hand in hand with the above, there are API tweaks that have been made. Specifically it will only return Ads (for the embed/random option) that are within a given schedule, or active if no schedule has been set.

There are also a few more tweaks on the kind of data you can get back for the ad object, which you can find here in the documentation.

UI tweaks

I've made a few minor UI tweaks, mainly making everything a little wider.

In the coming months I will look at restyling the main ad detail screen as it feels cluttered.

Future tweaks

With ad scheduling, I'd like to also surface this data a little easier for you, so you can filter for "upcoming" or "expired" ads. I am working on something that should be easy enough on the UI. More to come soon.

I can't type today, or create any longer sentences, so I hope the above is short and sweet for you. Excited to have pushed out this update.

More to come.

✌️❤️

It’s "ship a thing on a Monday". So I shipped some new goodies for Sublime Ads. Write up coming soon, after I have updated the documentation.

Have been working on ad scheduling in Sublime Ads. Still more to do, but I have the basic frontend pretty much sorted. Also has a pop up date picker.

The deploy went well. If you notice anything strange, let me know.

Deploying a few tweaks to Sublime Ads. If you notice any slowness… that’s a bigger database migration. Hopefully you won’t notice anything though ✌️

More Sublime Ads goodies today… now you can upload an avatar… because everyone does it haha. Makes the header look much nicer and comfy. This is a prelude to some "team" stuff that I am working on. Nice to have. It was fun!

Sublime Ads Update - View Tracking

This is a feature that has been requested since day one of starting Sublime Ads, and it's been available since launch... but it was never documented, nor was it fully complete. No more.

I'm happy to announce that in addition of tracking your "taps" you can now also track the amount of "views" an embedded ad receives.

Just like taps, views is just a simple counter that gets triggered. It is privacy preserving and holds no user data. It's just a "view" and that is it.

Some people might just find this useful to measure performance (I don't like using that word) of a given category and/or ad.

Views can be triggered via the API, check out the documentation here. In addition to using the API, views can be tracked via the Sublime Ads Embed option on your website. Check out the documentation here for that.

Views are opt-in by you and are not enabled by default when using the embed option.

To see "views" all you have to do is go to the homepage and select the "Show views" option in your statistics graph, next to the date picker - you can toggle between taps and views as needed. There are plans to have some sort of combined view at some stage. These stats are also available for each individual ad and category, so you can get into more details as needed.

I think this might be a very welcome feature for anyone that relies on this data.

That's it for now.

Happy coding and embedding!

Pushed out some updates to Sublime Ads today. Happy to finally get them out. A little out of time now, but will write a small post about the changes a little later and update the "Updates" page with even more tweaks/details that are not yet documented for embeds.