Coil Monetization Shortcuts: The Easy Way To Find Out How Much You Are Making

Written by johnonym | Published 2020/11/15
Tech Story Tags: monetization | programming | web-development | javascript | web-monetization | cryptocurrency | coil | blogging

TLDR How much do I get from a micro transaction for a user that visits my monetized page?Prerequisites: The reader needs to have a Coil subscription, and the Coil extension for Chrome. The details of a single transaction look like this:amount (the amount of assets, e.g. 2491) Amount of assets being transferred, and what currency (e.g XRP or USD) is being sent in one single transaction. If a transaction looks like the above example, it means that 2491 nano XRP (or 0.000002491 XRP)via the TL;DR App

How much do I get from a micro transaction for a user that visits my monetized page?

Prerequisites

The reader needs to have a Coil subscription, and the Coil extension for Chrome

How to sniff the transactions?

Right click anywhere on the page, and click "Inspect", to open the inspector window, and you will see something similar as the below image.
Copy and paste the below snippet in the console tab of your debugger tool to see the monetization in progress.
totalAmount = 0;
document.monetization.addEventListener('monetizationprogress', function(event){
  var amount = parseInt(event.detail.amount);
  amount = amount/(Math.pow(10,event.detail.assetScale));
  totalAmount += amount;
  console.log(totalAmount);
  console.log(event.detail);
});
And that's it. If the requirements are met, you will be able to see the accumulative transactions, as well as the details for a single transaction, like how much assets are being transferred, and what currency (e.g. XRP or USD). The console window will print every singe transaction made. The details of a single transaction look like this:
  • amount (the amount of assets, e.g. 2491)
  • assetScale (the proportion of the asset, e.g 9)
  • assetCode (the currency being transferred, e.g XRP)
If a transaction looks like the above example, it means that 2491 nano XRP (or 0.000002491 XRP) is being sent in one single transaction. You can find more details from Coil's documentation

Written by johnonym | Gamejammer
Published by HackerNoon on 2020/11/15