# Identifying authenticated users in custom code (header)

**URL:** <https://community.weweb.io/t/identifying-authenticated-users-in-custom-code-header/1567>\
**Category:** Ask us anything\
**Created:** [December 9, 2022, 1:56am UTC](https://community.weweb.io/t/identifying-authenticated-users-in-custom-code-header/1567 "2022-12-09T01:56:20Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![caffeinatedwes](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/caffeinatedwes/32/625_2.png) [@caffeinatedwes](https://community.weweb.io/u/caffeinatedwes)\
**Post date:** [December 9, 2022, 1:56am UTC](https://community.weweb.io/t/identifying-authenticated-users-in-custom-code-header/1567/1 "2022-12-09T01:56:20Z")

</div>

Hi WeWeb-ers.

I’m trying to integrate a product analytics tool ([https://livesession.io/](https://livesession.io/)), and the script by itself works great—

```auto
<!-- LiveSession.io code -->
    <script type="text/javascript">
    window['__ls_namespace'] = '__ls';
    window['__ls_script_url'] = 'https://cdn.livesession.io/track.js';
    !function(w, d, t, u, n) {
          if (n in w) {if(w.console && w.console.log) { w.console.log('LiveSession namespace conflict. Please set window["__ls_namespace"].');} return;}
          if (w[n]) return; var f = w[n] = function() { f.push ? f.push.apply(f, arguments) : f.store.push(arguments)};
          if (!w[n]) w[n] = f; f.store = []; f.v = "1.1";
  
          var ls = d.createElement(t); ls.async = true; ls.src = u;
          var s = d.getElementsByTagName(t)[0]; s.parentNode.insertBefore(ls, s);
      }(window, document, 'script', window['__ls_script_url'], window['__ls_namespace']);
  
      __ls("init", "abcdefghijklmnop", { keystrokes: false });
      __ls("newPageView");
    </script>
    <!-- END LiveSession.io code -->

```

However, I’m also trying to integrate it a way that identifies users, and I’m having trouble integrating the tracking code into WeWeb.

I tried using a Xano auth variable in the global website header code, but I received a build error when I tried to publish it. For example, the code I tried to publish looked something like this—

```auto
__ls("identify", { 
    email: `pluginVariables['asbcdef-485d-47be-b433-d43d771c64e1']['user']['email']`, 
})

```

Any idea what went wrong to cause the build to fail? Is there a different type of approach I should be doing to identify auth’d users with a 3rd party product analytics tool?

---

<div class="post-metadata">

**Author:** ![kevinwasie](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/kevinwasie/32/402_2.png) [@kevinwasie](https://community.weweb.io/u/kevinwasie)\
**Post date:** [December 10, 2022, 3:51pm UTC](https://community.weweb.io/t/identifying-authenticated-users-in-custom-code-header/1567/2 "2022-12-10T15:51:08Z")

</div>

Is that your exact code? Not sure if this is what is causing a build error, but do you need the quotes around the value for email?

\_\_ls(“identify”, {  
email: `pluginVariables['asbcdef-485d-47be-b433-d43d771c64e1']['user']['email']`,  
})

remove them:

\_\_ls(“identify”, {  
email: pluginVariables[‘asbcdef-485d-47be-b433-d43d771c64e1’][‘user’][‘email’],  
})

You may need them around “email”

---

<div class="post-metadata">

**Author:** ![caffeinatedwes](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/caffeinatedwes/32/625_2.png) [@caffeinatedwes](https://community.weweb.io/u/caffeinatedwes)\
**Post date:** [December 12, 2022, 4:52pm UTC](https://community.weweb.io/t/identifying-authenticated-users-in-custom-code-header/1567/3 "2022-12-12T16:52:20Z")

</div>

Thanks for chiming in, @kevinwasie. I _believe_ that was my exact code, but I can’t recall for certain.

> Not sure if this is what is causing a build error, but do you need the quotes around the value for email?

I don’t think it needs the quotes as it’s copied and pasted directly from their docs. However, I’m going to give that and some other ideas a go and report back.

 ![Screen Shot 2022-12-12 at 10.47.53 AM](https://us1.discourse-cdn.com/flex016/uploads/weweb/original/2X/a/a78279605f4f00226b8bad1008fbeb7cf5843dce.png)
