Triggering TagManager PageView And Setting custom url and title - All from Javascript

I am writing a Single Page Application. I am using the MatomoTagManager, and have configured a tag that watches for PageView triggers. My initial page load is recorded. When I try to trigger a new PageView with javascript like this: window._mtm.push({‘event’: ‘mtm.PageView’});`, the event doesn’t get logged at all, nor generate a call to the server.

I also want to know how I can save a specific title and URL, not the ones from my website, a custom title and url. What I tried was to create two variables, customUrl and customTitle, and set the value of these variables from javascript like this:
window._mtm.push({‘customTitle’: ‘CustomTitle’})
window._mtm.push({‘customUrl’: ‘CustomUrl’})
And then in my Matomo Analytics Tag, use these variables when saving the title and url.


Hi @aaaamugi
Can you share how you configured your:

  • Page view trigger
  • Page view tag


Hi @heurteph-ei ,
thanks for your reply,

I attach images of my two variables customUrl and customTitle, my Pageview Trigger and my Matomo Analytics Tag.

Matomo Analytics tag:

PageView trigger:


Hi @aaaamugi
Then you just have to create another trigger of type Custom Event.
This trigger will run also the Páginas vistas Tag as Páginas vistas already do (just add it in the list of Execute this tag when any of these triggers are triggered…).
To trigger your new trigger, just update the customTitle and customUrl datalayer variables and trigger the trigger:

window.addEventListener('hashchange', function() {
        _paq.push(['setCustomUrl', '/' + window.location.hash.substr(1)]);
        _paq.push(['setDocumentTitle', 'My New Title']);