Add share buttons to your website, enabling visitors to earn Bitcoin for sharing your pages.
<script src="https://tonicpow.com/scripts/tonicpow.js"></script>See the website integration guide for more info.
Add a div with a class name of 'tonicpow-widget' wherever you would like your share button to be placed. Set the following attributes:
<div class="tonicpow-widget" data-widget-type="share-button" data-target-url="https://tonicpow.com" data-button-id="myButton" ></div>
Now that the HTML has been added, you can initialize the button with some options, like callback handlers by calling the `shareButton` constructor, and passing the corresponding `data-widget-id` along with the configuration options.
TonicPow.shareButton('myButton', options)
<div class="tonicpow-widget" data-widget-type="share-button" data-target-url="https://tonicpow.com" data-button-id="myButton" ></div>
You can set a number of configuiration options to set text & colors, allow you to get the raw link data, handle error cases and more.
<script src="https://tonicpow.com/scripts/tonicpow.js"></script> <script> const onSuccess = (data) => { // You can access the raw link data here: // data.shortLink === { // short_link_url: "https://tpow.app/whateva" // title: "Some Campaign Title" // image_url: "https://res.cloudinary.com/tonicpow/image/upload/some_campaign_image.png" // target_url: "https://somewebsite.com" // slug: "some-campaign" // campaign page: https://tonicpow.com/campaign/some-campaign // } } const options = { onSuccess: onSuccess } TonicPow.shareButton('myButton', options) </script> <div class="tonicpow-widget" data-widget-type="share-button" data-button-id="myButton" data-target-url="https://tonicpow.com" ></div>
More information can be found in the code repository for the frontend javascript. See the Github repo and examples for more.