Hi, I have installed matomo for a high traffic website and also am using only the matomo tag manager code in my website. I followed https://peertube.floss-marketing-school.com/videos/watch/2e9c81d5-3f4b-4cdf-9959-34d52863b1d6 in setting up the user id. I have created a data layer as uid and associated with the custom variable. In my site, i’ll be getting a id for each unique user in the body tag.I dont have login/logout functionality.So i am tracking users based on this id.
<script>
var _mtm = _mtm || [];
window._mtm.push({'uid':'1000' });
</script>
Here 1000 is the id for a unique user.If another user comes, another new id will be generated.If the user returns, already generated id for that user will be used. So, I have added this 4 lines of code in the body part of all pages. But the user id is getting mapped only for 50% of the users.
Is there any other way to do this? Thanks in advance
You don’t by chance have also still the non-tagmanger-tracking code in addition to the Matomo Tag manager? In that case you might be tracking users twice (with only the latter being set up correctly.
But I’m getting the value for the userId only in the body part(tag). So i have used it in the body tag. Will it be right to shift the tag manager code from the beginning of the head tag to body tag after the data layer? Will it resolve this issue and will the tracking be done properly if I use it in body tag?? Thanks in advance