Amp-stories tracking


We have a amp-stories module on our site.

We used this from the form to track the stories.

            <script type="application/json">
                    "triggers": {
                        "trackPageview": {
                            "on": "visible",
                            "request": "pageview"
                    "requests": {
                        "base": "//${title}&url=${sourceUrl}&rand=${random}&apiv=1&urlref=${documentReferrer}&res=${screenWidth}x${screenHeight}&lang=${browserLanguage}&gt_ms=${serverResponseTime}&cs=${documentCharset}&_cvar={\"1\":[\"errorName\",\"${errorName}\"],\"2\":[\"errorMessage\",\"${errorMessage}\"]}",
                        "pageview": "${base}"

We are getting the the tracking data, however its being tracked as a new session. Not as a continuation of the users session.

Can anyone help.


That’s because with AMP you can’t use the Matomo tracking script, but just (as you have done) instruct the AMP code to send a request to Matomo on every page view with the data from the ${something} variables.

In theory Matomo should still be able to detect sessions as mentioned here (without cookies):