APIs & Integrations

mk5
Member

Tracking in Angular 11

Hi everyone,

 

I am having trouble integrating tracking with my Angular 11 application. I followed this link and setup the initial scripts in my index.html file and then call the setPagePath and setPageView when the router events fire to try to update page views.

 

When a user submits a form, hubspot dashboard doesn't show any page views associated with the user. I am using custom forms and calling the hubspot forms api to send the data (including the hutk cookie). 

 

Has anyone ran into a similar issue? Anyone successfully integrated tracking with Angular or another SPA?

 

related code:

 

index.html:

 

<head>

... other stuff

  <script>

    var _hsq = window._hsq = window._hsq || [];

    _hsq.push(['setPath', '/']);

  </script>

</head>

 

later in body tag:

 

<script type="text/javascript" id="hs-script-loader" async defer src="//js.hs-scripts.com/#######.js"></script>

 

---------------------------------------------

 

code which fires when a navigation event occurs:

 

var _hsq = (<any>window)._hsq = (<any>window)._hsq || [];

_hsq.push(['setPath', path]);

_hsq.push(['trackPageView']);

 

0 Upvotes
1 Reply 1
dennisedson
HubSpot Product Team
HubSpot Product Team

Tracking in Angular 11

@itur , would you be able to help @mk5 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