# Issue with tracking code and SPA - Tracking code only loads and scan first loaded page

**URL:** <https://community.hubspot.com/t/issue-with-tracking-code-and-spa-tracking-code-only-loads-and-scan-first-loaded-page/31219>\
**Category:** Lead Capture Tools\
**Tags:** forms\
**Created:** [February 3, 2021, 6:36pm UTC](https://community.hubspot.com/t/issue-with-tracking-code-and-spa-tracking-code-only-loads-and-scan-first-loaded-page/31219 "2021-02-03T18:36:03Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![itur](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/itur/32/82797_2.png) [@itur](https://community.hubspot.com/u/itur)\
**Post date:** [February 3, 2021, 6:36pm UTC](https://community.hubspot.com/t/issue-with-tracking-code-and-spa-tracking-code-only-loads-and-scan-first-loaded-page/31219/1 "2021-02-03T18:36:03Z")

</div>

Hi,

I have an issue (aka my biggest nightmare) with the tracking code installed in a SAP built in Angular with collected forms

The main problem is that the tracking code is properly tracking the first “page” load. However, it does not rescan a page to look for a form if the user moves around on the site before hitting the form page. In this case, nothing is sent from the form to hubspot (in this case to create a contact). I would use the Contacts API, but then all the ads analitycs are lost, since it sets the “original source” field to “Offline Source” and it doesnt even recognise that a form has been submited.

Is there a way to force the HubSpot script to rescan for a form each time the component content loads? This is driving me crazy.

Thanks a lot in advance!

---

<div class="post-metadata">

**Author:** ![TitiCuisset](https://avatars.discourse-cdn.com/v4/letter/t/8baadc/32.png) [@TitiCuisset](https://community.hubspot.com/u/TitiCuisset)\
**Post date:** [February 5, 2021, 1:40pm UTC](https://community.hubspot.com/t/issue-with-tracking-code-and-spa-tracking-code-only-loads-and-scan-first-loaded-page/31219/2 "2021-02-05T13:40:48Z")

</div>

Hi @itur

Thank you for reaching out.

I want to tag some of our experts on this - @tjoyce @thesnappingdog @MatthewShepherd do you have suggestions for @itur on this?

Thank you!

Best

Tiphaine

---

<div class="post-metadata">

**Author:** ![tjoyce](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/tjoyce/32/88832_2.png) [@tjoyce](https://community.hubspot.com/u/tjoyce)\
**Post date:** [February 8, 2021, 10:43am UTC](https://community.hubspot.com/t/issue-with-tracking-code-and-spa-tracking-code-only-loads-and-scan-first-loaded-page/31219/3 "2021-02-08T10:43:46Z")

</div>

Hi @itur -

You should be able tap into your router for angular and update the tracking events yourself

```lia-code-sample
 _hsq.push(['setPath', '/what-we-do']);
 _hsq.push(['trackPageView']);

```

```lia-code-sample
 import { Component, OnInit } from '@angular/core';
 import { Router, NavigationEnd } from '@angular/router';
 import { filter } from 'rxjs/operators';

 @Component({
 selector: 'app-my-class',
 templateUrl: './my-class.component.html',
 styleUrls: ['./my-class.component.scss']
 })
 export class MyClassComponent implements OnInit {
 constructor(private router: Router) {}

 ngOnInit(): void {
 this.router.events
 .pipe(filter(event => event instanceof NavigationEnd)) 
 .subscribe((event: NavigationEnd) => {
 _hsq.push(['setPath', '/what-we-do']);
 _hsq.push(['trackPageView']);
 });
 }
 }

```

> **[Accounts Dashboard | HubSpot](https://app.hubspot.com/myaccounts?next=developerdocs&redirect=%2Fapi-reference%2Flegacy%2Ftracking-code-v1%2Foverview)**

> **[Accounts Dashboard | HubSpot](https://app.hubspot.com/myaccounts?next=developerdocs&redirect=%2Fapi-reference%2Flegacy%2Ftracking-code-v1%2Foverview)**

---

<div class="post-metadata">

**Author:** ![itur](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/itur/32/82797_2.png) [@itur](https://community.hubspot.com/u/itur)\
**Post date:** [February 9, 2021, 8:51am UTC](https://community.hubspot.com/t/issue-with-tracking-code-and-spa-tracking-code-only-loads-and-scan-first-loaded-page/31219/4 "2021-02-09T08:51:09Z")

</div>

Thank you so much! That was really helpfull 😊
