Attach Event to Contact with JavaScript Events API?


When using the HTTP Events API (, it looks like it's possible to specify an email which attaches the event to a contact. Is it possible to do this with the JavaScript Events API (

I tried doing the following, but it didn't work.

  _hsq.push(["trackEvent", {
      id: "User has visited your website",
      value: 0,
      email: ''


Hi @dwebrich,

When paired with the Identify a visitor method, the JavaScript event you create can be associated with a contact via email.

For example:

    function getParameterByName(name) {
        var match = RegExp('[?&]' + name + '=([^&]*)').exec(;
        return match && decodeURIComponent(match[1].replace(/\+/g, ' '));

    var _hsq = window._hsq = window._hsq || [];
        email: getParameterByName("email")
    _hsq.push(["trackEvent", {
        id: "User has visited your website",
        value: 0