Amp-stories tracking

Hi,

We have a amp-stories module on our site.

We used this from the form to track the stories.

<amp-analytics>
            <script type="application/json">
                {
                    "triggers": {
                        "trackPageview": {
                            "on": "visible",
                            "request": "pageview"
                        }
                    },
                    "requests": {
                        "base": "//pluc.tv/wp-content/plugins/matomo/app/matomo.php?idsite=1&rec=1&action_name=${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}"
                    }
                }
            </script>
        </amp-analytics>

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.

Hi,

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):
https://matomo.org/faq/general/faq_21418/