The purpose of these tools is to collect statistical data about payments, which allows merchants to identify possible bottlenecks in the flow of the payment and to optimize the payment flow so that consumers are not confused by it.
To make sure that the statistical data is correctly tied to each payment, a token must be set using
The token should be taken from the
StartPayment API call response (
Token must be set ideally before the first
on...() call is made. If the token is not set within 10 seconds of the first communication attempt, an error will be logged to console. However, the events will still be sent if the token is set later.
||Sets the authentication token which allows other function calls to send information to server. The token must be taken from
||Should be called whenever payment target crypto address is copied to the clipboard by the consumer.|
||Should be called whenever payment amount is copied to the clipboard by the consumer.|
||Should be called when consumer requests the QR code to be displayed to them (on click,...).|
||Should be called when the QR code image is loaded (on load, on error).|
||Should be called when consumer requests the alternative QR code to be displayed to them (on click,...).|
||Should be called when the alternative QR code image is loaded (on load, on error).|
||Should be called before widget is closed by the consumer. If it is not possible to detect the closing event, call this function periodically (every few seconds) while the widget is still opened.|
This function should be called whenever JS detects that the crypto address was copied to clipboard.
This function should be called whenever JS detects that the amount of crypto was copied to clipboard.
<div oncopy="CryptoPaymentStats.onAmountCopy();">0.00701648 BTC</div>
These functions collect information about which QR code was displayed, how long the loading took and if it was successful. Note that
onQRCodeInit() / onQRAltCodeInit() function calls signal the intent of the user to see the appropriate QR code. In other words, it is possible to call
<script> CryptoPaymentStats.onQRCodeInit(); </script> <img id="qr" src="https://api.limitlex.com/qr/?d=bitcoin%3A33P6AnQfheFxnajXQwFas5jyo1nuhTY4M8%3Famount%3D0.00001" onload="CryptoPaymentStats.onQRCodeLoad(true);" onerror="CryptoPaymentStats.onQRCodeLoad(false);"> <img id="qralt" src="https://api.limitlex.com/qr/?d=bitcoin%3A33P6AnQfheFxnajXQwFas5jyo1nuhTY4M8" onload="CryptoPaymentStats.onQRAltCodeLoad(true);" onerror="CryptoPaymentStats.onQRAltCodeLoad(false);" style="display: hidden;"> <button onclick="CryptoPaymentStats.onQRAltCodeInit(); $('#qr').hide(); $('#qralt').show(); ">show alternative QR code</button>