CoilShuffler

Edit: April 2019

The original post from February 2019 has been republished due to renewed interest in Coil and runtime functions. Earlier blogpost that did not use the new Coil Metatag has been removed. On this blog, GoodXRP and my own twitterhandle has been set as possible recipient, which means that if you're coiling to this blog right now, you're either coiling to me or GoodXRP by using the mechanism described in this post.

Furthermore "GoodXRP" (twitterhandle https://www.xrptipbot.com/u:goodxrp/n:twitter) has also been added to the list of possible recipients in the script maker. 

What is it

The CoilShuffler can change recipient of a Coilstream runtime. This means your website can change the metatag for Coil dynamically, either your own or a charity based on percentage of chance for Charity, that you set. The Metatag is set on each visit.

It uses the Metatag method which will be the only viable Coil method after July 1st 2019.

After you generate the code for your website you simply copy the generated code into your website's HTML "head" section.

How to

  1. You choose which charity you would like to support.
  2. You choose which threshold there is for the charity to be chosen by your website visitors. 
  3. Inserting your own twitterhandle in the input box.

Generate head section code


Choose Charity

 *

Choose chance (%) to donate to charity instead of website owner, by a Coil visitor

 **

Insert your own Twitterhandle here


Press the button to generate code for your website




Just copy the code into your website "head" section.
That's it, you're ready to earn and contribute to charities.

*If you choose GoodXRP, all GSG charities will benefit from the Coil, since it's redistributed equally after it reaches the GoodXRP account.

**(If the Charity handle is not chosen runtime, the Coilstream will go to you instead, because then your handle will be inserted instead. So it's either your handle or the charity handle that will receive the Coilstream and it's only determined runtime for each visitor on each visit, which it will be)


Bonus info Counter

If you would like the Coil counter to appear for your Coil enabled visitors, you can add this snippet in your html head code also:

<script src="https://cdn.coil.com/counter.js"></script>
<script>
  window.WebMonetizationScripts.createCounter()
</script


How to verify

If you use Chrome and right click on your webpage you will be able to see which handle was injected by the code by clicking "Inspect"

select the head section of your html document to check which twitterhandle was chosen
Remember, the Metatag might be set to the other possible Metatag, each time another person visit or when you refresh the page, of course depending on percentage chance.

 

Explanation and Disclaimer



If you choose a 50% chance, it is very likely half of your visitors will donate to you and the other 50% of the visitors will be donating to the charity you have chosen, when generating the code.

If you choose e.g. 20% chance, then there will be a 20% chance that a Coil enabled visitor to your website will donate to the charity and an 80% chance that any of the visitor will donate to your twitterhandle instead.

If the chance is set to 30% it is LIKELY (but not guaranteed) that 3 out of 10 of your visitors will donate to the charity and 7 out of 10 visitors will donate to you.

Since it's based on a random generator it's impossible to know how many are actually donating to you and how many to the charity. By lowering the percentage of chance, when generating the code you can to some extent influence the most likely outcome of the real distribution.

Technical explanation 

By using a cryptographic number generator, either the charity handle will receive the Coilstream or your (website owner) twitterhandle will receive the Coilstream.

The choice of paymentpointer is determined runtime clientside and the Coil Metatag is injected using DOM manipulation into the head section of your webpage. Coil will then read the Metatag and start streaming to the runtime created Coil Metatag recipient.
It's pure JavaScript designed to choose different paymentpointers (yours or the charity) for the visitors.

It is based on chance so the distribution might vary greatly. 

On each page refresh and each visit the Metatag is defined once again but of course either it'll be your Twitterhandle or the Charity Twitterhandle. 

Disclaimer

I am not affiliated or endorsed by Coil.
Use the code at your own risk.

Contact

Feel free to contact me with any questions on twitter: https://mobile.twitter.com/research_omega