Angular 9 project


Looking to integrate the following components into an angular 9 website.
- tracking code (easy..just add to index.html and it works)
- page tracking (seen some examples using js snippets. Is that the only way?)
- form submissions (can hubspot js script automatically pick up angular forms? Or do we need to integrate it via an api call to hubspot?)

3 Replies 3
HubSpot Employee

Hey @mohib,


Just to clarify,


1. What do you mean by page tracking? I'd expect that if the tracking code has been installed correctly and if visitor submit a form submission, the page views will reflect on the contact record.


2. As for form, if the Angular form support the requirements for non-HubSpot form, stated here: Use non-HubSpot forms --> Your team will be able to use the non-HubSpot form.


However, if the Angular form doesn't meet the requirement, the next best option is to use the Submit data for a form | Forms API.


Hello WendyGoh!

Do you know where to place the set page path code in Angular 9 for tracking pages?

I have read this link, but I am not sure if the script of the 'set page path' code should be in the 'index.html' or somewhere else.

Any advice would be very helpfull!


Hello mohib!


How did you add the `page tracking'. Did you get it right? Any advice will be helpfull.

Below I share my code with you.

I placed it in my index.html, but it does not seem to track pages.


<!-- Set up the path for the initial page view -->
var _hsq = window._hsq = window._hsq || [];
_hsq.push(['setPath', '/']);


<!-- Start of HubSpot Embed Code -->
<script type="text/javascript" id="hs-script-loader" async defer src="//"></script>
<!-- End of HubSpot Embed Code -->


<!-- Tracking subsequent page views -->
var _hsq = window._hsq = window._hsq || [];
_hsq.push(['setPath', '/otras-soluciones/anthos']);