Javascript API: identify


#1

I’m currently trying to test website activity. I have a contact with the email address "XXXX@gmail.com" and have a page on my website that passes the following parameters to the hubspot javascript API:

var _hsq = window._hsq = window._hsq || [];
hsq.push(["identify", '{email: "XXXX@gmail.com"}']);
<script type="text/javascript" id="hs-script-loader" async defer src="//js.hs-scripts.com/2873354.js"></script>

No activity seems to be logged, even when this is done on a incognito window. Is this correct?

Im using the Free version of Sales + Marketing


#2

Hey ofogden,

I think you have unnecessary quotes around the {email} section as well as wrote hsq.push instead of _hsq.push. I just finished working on a similar project today and this code should work for you!

<script type="text/javascript">
var _hsq = window._hsq = window._hsq || [];
_hsq.push(["identify", {email: "XXXX@gmail.com"}]);
</script>
<script type="text/javascript" id="hs-script-loader" async defer src="//js.hs-scripts.com/2873354.js"></script>