https://github.com/interledger/wm2-glitch-exclusive-content-basic
Glitch examples for WM2
https://github.com/interledger/wm2-glitch-exclusive-content-basic
Last synced: 9 months ago
JSON representation
Glitch examples for WM2
- Host: GitHub
- URL: https://github.com/interledger/wm2-glitch-exclusive-content-basic
- Owner: interledger
- Created: 2023-01-09T14:36:26.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-01-10T19:04:40.000Z (over 3 years ago)
- Last Synced: 2025-07-31T10:44:08.639Z (10 months ago)
- Language: JavaScript
- Size: 2.93 KB
- Stars: 0
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# Web Monetization
Web Monetization is a browser API which allows a website to make money without using ads and without requiring any user interaction. The user signs up to a Web Monetization Provider like Coil, and the provider sends micropayments to Web Monetized websites whenever the user visits them.
# Exclusive Content (Basic)
One of the perks of Web Monetization is that its JavaScript API can be used to make your page respond to Web Monetization.
You can reward the people who support your site by giving web monetized viewers exclusive content.
This is a basic example of showing exclusive content only to web monetized visitors.
### ← index.html
The `monetization` meta tag contains a payment pointer, which is the digital wallet address to send micropayments to.
To see the "View as Web Monetized visitor" button, you **must** view the page in an iframe, not in a new window.
### ← exclusive-content-basic.js
Listens for the `monetizationstart` event, then makes the exclusive content element visible by removing the defined CSS class.
### ← wm-previewer.js
Simulates Web Monetization and adds the "View as Web Monetized visitor" button to `index.html`. This script only activates in iframe.
### ← css/exclusive-content.css
Contains the class used to hide exclusive content. The `exclusive-content-basic.js` removes the class for web monetized visitors, making the content visible.
# Additional References
If you're viewing this outside of webmonetization.org, you can find more information here:
* [Webmonetization.org](https://webmonetization.org)
* [Exclusive Content doc on webmonetization.org](https://webmonetization.org/docs/exclusive-content)