Tracking JSE earnings by UserID or SubID

Website Cryptocurrency Mining

Tracking JSE earnings by UserID or SubID

October 17, 2017 Code Development 0

It is possible to track earnings across your websites users by placing their user ID in the subid field and then using the API to query the balance.

Here is a simple example written in PHP.

<html>
<head>
</head>
<body>
<?php
$users = array(“James”,”John”,”Tracey”,”Dave”);
?>// Standard JSEcoin publisher code, note the dynamic insertion of <?php echo $users[0] ?> = James<script type=”text/javascript”> !function(){var e=document,t=e.createElement(“script”),s=e.getElementsByTagName(“script”)[0];t.type=”text/javascript”,t.async=t.defer=!0,t.src=”https://load.jsecoin.com/load/2895/mysite.com/<?php echo $users[0] ?>/0/”,s.parentNode.insertBefore(t,s)}(); </script>

<?php
// Now lets look up how much a user has in his balance using PHP CURL.
$url = ‘https://api.jsecoin.com/server/api/balance/123myAPIkey123/’.$users[0].’/’;
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_TIMEOUT, 5);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$data = curl_exec($ch);
curl_close($ch);

echo ‘<h3>Data Returned: ‘.$data.'</h3>’;

// Returns: {“success”:1,”notification”:”Your balance is 99 JSE”,”balance”:99}
?>

</body>
</html>

 

This is a basic example showing how to dynamically insert the userID as a subID server side. We then use PHP CURL but you could also just visit the URL to get the balance for that user. You’ll need to add your own API key and set the API access to at least “Level 1 – Read” to get this working for your account.

You could also use subID tracking to track earnings for:

  • Individual Pages
  • Sub-domains
  • Affiliates
  • Traffic Sources
  • Any other alphanumeric reference you have

There’s more information on the API at https://jsecoin.com/api/