I've followed the Matomo docs (not especially helpful in terms of where to put things and how to implement them) and I've also tried the method of using ngx-Matomo and for some reason that isn't working either.
The issue I'm having is that my initial visit gets logged, but nothing beyond that when I click on new "pages" (routes). The only time I get a trigger is if I refresh the page or reload my localhost or test site but normal navigation is not being tracked.
I currently do not have access to any options inside of Matomo itself due to profile restrictions but I'm wondering if that's where the problem lies.
Here is my ngx-matomo code and boiler plate Matomo script (URLs and some names changed to protect the project):
var _paq = window._paq || [];
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
(function () {
var u = "//MY_URL/";
_paq.push(['setTrackerUrl', u + 'piwik.php']);
_paq.push(['setSiteId', '000']);
var d = document, g = d.createElement('script'), s = d.getElementsByTagName('script')[0];
g.type = 'text/javascript'; g.async = true; g.defer = true; g.src = u + 'piwik.js'; s.parentNode.insertBefore(g, s);
})();
App root:
import { Component, OnInit } from '@angular/core';
import { Router, NavigationEnd } from '@angular/router';
import { filter } from 'rxjs/operators';
import { MatomoInjector } from 'ngx-matomo';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
constructor(router: Router, private matomoInjector: MatomoInjector) {
this.matomoInjector.init('//MY_URL/', 000);
}
component setup:
import { Component, OnInit } from '@angular/core';
import { ResourceLinksService } from './resource-links.service';
import { MatomoTracker } from 'ngx-matomo';
@Component({
selector: 'app-component',
templateUrl: './component.html',
styleUrls: ['.component.css']
})
export class Component implements OnInit{
constructor(private matomoTracker: MatomoTracker) {
}
ngOnInit() {
this.matomoTracker.setDocumentTitle('Title Test');
}
}
This NPM is also imported in my app.module.ts
Any help would be great. I'm at a total loss as to why the ngx-matomo isn't working. This could point to an issue with the Matomo service I'm using itself.