iparker
November 21, 2020, 5:11am
1
Hello,
I’m trying to understand and implement a simply first data layer for tracking as described at https://matomo.org/docs/tag-manager/#data-layer .
So I insert the following code before my container:
<script>
var _mtm = _mtm || [];
_mtm.push({'weather': 'sunny'});
</script>
I also created a new data layer variable named weather in the container.
But where do I see the values of this variable? Where comes the screenshot in tag manager how to with the text “And then analyze it within Matomo Analytics as shown in the screenshot example below” from? Which step is missing in my case?
Thanks for some help with this!
Best regards,
Timo
iparker
November 21, 2020, 5:48am
2
And I have a next, more detailled question about this topic:
I defined some other variables:
mtm.push({‘userLogin’: true});
_mtm.push({‘userType’: ‘js’});
_mtm.push({‘userId’: ‘123456’});
Now I what to use these values in a html tag script like this:
<script>
_paq.push(['setUserId', '{{userId}}']);
_paq.push(['setCustomDimension', 1, '{{userLogin}}']);
_paq.push(['setCustomDimension', 2, '{{userType}}']);
</script>
But it seems that this is not working. I don’t see these dimensions in the visitor log.
Do I misunderstand anything or do you see my mistake?
Thanks for some help!
Best regards,
Timo
PeterM
(Peter)
November 21, 2020, 3:14pm
3
Hi, did you already check the trainings video’s about the tag manager on https://matomo.org/tag-manager-training/
Perhaps they help with understanding the datalayer
Regards,
Peter
1 Like
iparker
November 21, 2020, 7:40pm
4
And another addition:
Now I see the dimensions in the visitor log, but the value I see there is something like
login: window.MatomoTagManager.customHtmlDataStore[1]
user_type: window.MatomoTagManager.customHtmlDataStore[2]
How can I get the “real” value and not the object key?
iparker
November 25, 2020, 9:33am
5
I found a solution for the problem:
<script>
_paq.push(['trackContentImpression', 'Backend', {{PageUrl}}]);
</script>
The variables shout not be passed in single quotation marks in the tag-script.
2 Likes