I followed instructions to the letter at https://matomo.org/faq/tag-manager/how-do-i-set-the-user-id-using-matomo-tag-manager/#1-first-we-need-to-declare-the-matomo-tag-manager-data-layer-variable-in-our-website-with-the-following
<!-- Matomo -->
<script>
var _paq = window._paq = window._paq || [];
/* tracker methods like "setCustomDimension" should be called before "trackPageView" */
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
(function() {
var u="//www.mydomain.com/matomo/";
_paq.push(['setTrackerUrl', u+'matomo.php']);
_paq.push(['setSiteId', '3']);
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
g.async=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s);
})();
</script>
<!-- End Matomo Code -->
<!-- Matomo Tag Manager -->
<script>
var _mtm = window._mtm = window._mtm || [];
_mtm.push({'mtm.startTime': (new Date().getTime()), 'event': 'mtm.Start'});
var userVar123 = 'userVar123';
_mtm.push({'uid':'userVar123' });
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
g.async=true; g.src='https://www.mydomain.com/matomo/js/container_5Z3WE6XJ.js'; s.parentNode.insertBefore(g,s);
</script>
<!-- End Matomo Tag Manager -->
Of course… “mydomain” has the actual name of my domain
Above JS is within the tags
UserId doesn’t show up in “visits logs” → “view visitor profile”
& the “User IDs” in the “visitors section” says “There is no data for this report.”. I had tried moving the push for uid after the other code, as well, but same results
p.s. ignore the userVar123: i added it because i wasn’t sure if it was a string or if it had to be a javascript variable. I couldn’t understand the documentation clearly… so just added it for testing.
The visits are getting logged… it is just the userIds which are missing
Any help please?
Thanks