GTM variables and Matomo _paq,push

(Dan Katz) #1

We are using Google Tag Manager so we can use both Google Analytics and Matomo without a developer to place the variety of customized push events within the code on each page or link.
We have this working with Google Analytics to fire off the events, custom events, custom dimensions and the variety of other GA push code. Easy as this is all built it.
Now comes the lift to get this running in Matomo.
I see and am familiar with the code to push an event or other aspect into Matomo with the following when editing the JS code. However, I do have a few questions as this relates to GTM to make this easier.

  1. Can I simply create a GTM HTML tag with the above script and place in the dataLayer variables or JS variable names for Event Category, etc. Will GTM then insert these into the Matomo script?
  2. Can this HTML tag then have this simple line since the Matomo JS tag has already fired? Or, does this also need an additional trackPage line to record this to the Matomo server?

(Dan Katz) #2

BTW To others - outside of this system I was told that yes we can use GTM variables in these HTML tags.

Now my question is the format.

_paq.push([‘trackEvent’, ‘Forgot Password - Request’, ‘{{Click Text}}’, ‘{{Form URL}}’]);

I have the above statement. Should I have a single quote around the GTM variable? Or, should the quotes not be there?