APIs & Integrations

darshanDV
Member

Tracking code not working with function calls

 

Hello, 
We have an AngularJs 1.5 SPA website with a non-hubspot form. We have added the HubSpot tracking code, have added code to manually track pageviews, identify a visitor and events. Whenever a form submission happens, we can see in the network tab a GET request to track.hubspot.com (with 200 OK)  captured from the form submission.
Below code is used to push the event.

 

var _hsq = window._hsq = window._hsq || [];
_hsq.push(["identify", {
    email: params.contactEmail, 
    firstname: params.contactName,
    phone: params.contactNumber,
}]);
_hsq.push(["trackCustomBehavioralEvent", { 
    name: "Lead creation",
    properties: {
        email: params.contactEmail
    }
}]);

 

The tracking code have been added to the website correctly :

 

<script>
var _hsq = window._hsq = window._hsq || [];
_hsq.push(['setPath', '/home-page-path']);
</script>
<script type="text/javascript" id="hs-script-loader" async defer src="//js.hs-scripts.com/the-domain-id.js"></script>
<script>
var _hsq = window._hsq = window._hsq || [];
_hsq.push(['setPath', '/some-path']);
_hsq.push(['trackPageView']);
</script>

 

I have added the above function calls for creating contacts and events as per https://developers.hubspot.com/docs/api/events/tracking-code#identify-a-visitor.
But for some reason i'm not able to see any of the page view or contacts created.
 
Is creation of contacts with tracking code available on Free License? Or is there anything else that needs to be done?
Any help would be immensely appreciated.
0 Upvotes
dennisedson
Community Manager
Community Manager

Tracking code not working with function calls

@tominal , any chance you could lend a hand here?

Thanks,

Dennis




HubSpot Community Developer ShowMake sure to subscribe to our YouTube channel
where you can find the HubSpot Community Developer Show
0 Upvotes