Using the document.title of a previous page using History API for Piwik

0
Within our project, we use Piwik Pro for user analytics. There is an option for automatic page tracking using the History API in the browser. This is a common practice for Singe Page Applications (SPA): How can I track a single-page application (manual method)? | Piwik PRO help center. I can see a history object in my browser but it seems to miss the document.title of the previous page in the history. Therefore, the SPA tag / trigger is not even fired and no data is sent to Piwik Pro.    Did anyone face this issue before and fix it? I’m trying to implement this WITHOUT using JS actions or widgets everywhere.   Thanks in advance, Jeroen
asked
1 answers
0

Hi Jeroen,

I don’t think you need to access the document.title of the history object. As far as I can tell from the Piwik documentation, you need to configure a history change trigger, which triggers every time the window.history object changes. Then, you can configure Piwik to retrieve the document.title after the history trigger goes off. document.title correctly returns the current page title on a Mendix page, so that should do the trick.

answered