# Trying to hyper-target our lurkers and incentivize sign-ups 🚀 (and run a JS on login)

**URL:** <https://meta.discourse.org/t/trying-to-hyper-target-our-lurkers-and-incentivize-sign-ups-and-run-a-js-on-login/70074>\
**Category:** Product Support\
**Created:** [September 14, 2017, 9:07pm UTC](https://meta.discourse.org/t/trying-to-hyper-target-our-lurkers-and-incentivize-sign-ups-and-run-a-js-on-login/70074 "2017-09-14T21:07:48Z")\
**Posts on this page:** 1\
**Showing post:** 15

<div class="post-metadata">

**Author:** ![simon](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/simon/32/339122_2.png) [@simon](https://meta.discourse.org/u/simon)\
**Post date:** [September 15, 2017, 10:01pm UTC](https://meta.discourse.org/t/trying-to-hyper-target-our-lurkers-and-incentivize-sign-ups-and-run-a-js-on-login/70074/15 "2017-09-15T22:01:02Z")

</div>

> [@Justin\_Veenema](#):
>
> Can I set the cookie to expire in 7 days?

You can set the time based off the current time. Double check this code. You can test it out in your browser’s developer tools to see that it’s working. The math could be simplified.

```plaintext
<script type="text/discourse-plugin" version="0.8">
        if (api.getCurrentUser()) {
        const now = new Date();
        let time = now.getTime();
        time += 60 * 60 * 24 * 7 * 1000; // seconds * minutes * hours * days * milliseconds
        now.setTime(time);
        document.cookie = "logged_in=true; expires=" + now.toUTCString();
    }
</script>

```

---

_[View the full topic](https://meta.discourse.org/t/trying-to-hyper-target-our-lurkers-and-incentivize-sign-ups-and-run-a-js-on-login/70074)._
