<aside> ⚠️ Beware, this guide requires basic coding and javascript knowledge.

</aside>

<aside> ⚠️ If you will be using personally identifiable information (PII) in your identifier, please include this in your privacy policy. HockeyStack bears no responsibility for holding this type of data.

</aside>

It is just as important to know who your users are as what actions they’ve performed.

You can send both a unique identifier (usually email but can also be another id, username etc.) and any other custom properties (plan, role, company etc.) of your users to HockeyStack.

Bear in mind that using this method does not send a separate action to HockeyStack, it only updates the properties of that user. For sending custom actions, see Tracking Custom Goals.

Sending Unique Identifier

As mentioned before, this unique identifier is in most cases the email of the user. However, if you know the consequences (ask us!), you can send any other unique identifier - like an id or a username - here as well.

Method #1

For this method, you would need HockeyStack to be already loaded in the website. See the disclaimer for more technical info. Then, anywhere in your JavaScript, include:

HockeyStack.identify('<your identifier>');

Method #2

Change the script to include data-identity.

Example for HTML

Add the highlighted section to your integration snippet:

<script async **data-identity="<your identifier>"** data-apikey="<your api key>" data-cookieless src="<https://cdn.jsdelivr.net/npm/hockeystack@latest/hockeystack.min.js>"></script>

Example for other platforms

Add the highlighted line to your integration snippet:

<script>
  var hsscript = document.createElement("script");
  hsscript.id = "hockeystackscript";
  hsscript.src = "[<https://cdn.jsdelivr.net/npm/hockeystack@latest/hockeystack.min.js>](<https://cdn.jsdelivr.net/npm/hockeystack@latest/hockeystack.min.js>)";
  hsscript.async = 1;
  hsscript.dataset.apikey = "<your api key>";
  hsscript.dataset.cookieless = 1;
  hsscript.dataset.identity = <your identifier>;
  document.getElementsByTagName('head')[0].appendChild(hsscript);
</script>

Sending Custom Properties