I’m tring to use google analytics to monitor activities on my laravel site, as you can see i managed to record the events by $user_name
witch is great however how to i associate this user name with another variable for example $project_id
so i can see data for each user and on each different project.
any idea how i can achieve this? here is my code:
<script>
$(document).ready(function(){
$(document).mousemove(function(){
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-9YXX', {
'custom_map': {'dimension<Index>': 'user_id'}
});
gtag('event', 'user_name', {'user_id': '{!!$user_name!!}'});
});
});
</script>