Simplifying Web Monetization

Since Coil’s launch, hundreds of sites have become web-monetized. It’s just a matter of adding a couple of scripts, and you can make money (through Interledger) for every Coil subscriber who visits your site.

(header photo by Khai Sze Ong on Unsplash)

Based on feedback from these sites, the Interledger community has reworked the Web Monetization standard, making it even simpler to use. The improvements and trade-offs are listed below. Credit to Michiel de Jong for originally suggesting this idea.

The old way to monetize your site was by including this code snippet:

<script src="https://polyfill.webmonetization.org/polyfill.js"></script>

<script src="https://cdn.coil.com/donate.js"></script>

<script>

window.WebMonetizationScripts.donate({

paymentPointer: '$twitter.xrptipbot.com/sharafian_'

})

</script>

The new way to monetize your site is by adding a single tag to your page’s :

<meta name="monetization" content="$twitter.xrptipbot.com/sharafian_" >

This feature is available in the Coil extension version 0.0.21 and higher. An upgrade to the open-source Minute extension is in-progress.

What has Improved?

Security

Loading external scripts into your site is a big risk. The previous version of Web Monetization required external scripts in order to work. For sites that dealt with sensitive data, it could be a deal-breaker.

Web Monetization is now a static HTML tag. That means it can’t be used to compromise any sites.

Performance

Loading the Web Monetization polyfill took time and bandwidth. It also needed to be parsed every time you loaded a Web Monetized page.

Now, Web Monetization loads no files into the page. All the logic is handled by your browser extension in the background.

Simplicity

The “donate” script that most sites use to wrap Web Monetization is 450 lines of code. If you tried to use the Web Monetization API directly, it was very easy to make mistakes.

The new Web Monetization standard lets the user’s extension handle the complex logic instead of the page.

Events are still emitted when monetization occurs, so you can still easily add counters and thank-you messages to your sites.

What was sacrificed?

Client-Side Flexibility

Web Monetization no longer exposes the entire STREAM library. That means you can’t do things like turn the stream on/off, pay to multiple destinations, or other advanced features. What we noticed, though, was that all of these features can be implemented server-side.

For example, a revenue-splitting SPSP server is already implemented for anybody to run. Premium content on the server side is also implemented. As Web Monetization gets more adoption, we expect hosted versions of these services to become available.

A Browser Extension is Now Required

The polyfill-based version of Web Monetization used iframe communication to work on some browsers without any extension. Many browsers, such as Safari, didn’t support this flow.

Few people used Web Monetization without an extension, so we decided that it’s easier to always require an extension. This makes things simpler for the user as well as developers.

EDIT: on Coil.com, we have a script that enables Web Monetization for Coil users with no extension. You can still use Coil.com with a non-Coil web monetization extension!

Notes

- You can see the discussion for this spec change here.

- You can read the current draft of the Web Monetization standard here.

Bonus: Some Great Web-Monetized sites

Continue reading with a Coil membership.