I am using GA-4 to track user activity on my nextJs website. I have a few custom dimensions and custom metrics to satisfy my requirements. For example, I am firing the event, userDetailsEvent with user details when the user logs in.
window.dataLayer.push({
event: userDetailsEvent,
userName: "ABC",
role: "admin"
})
userName
and role
both are sent to GA via Google Tag manager as parameters. GA accepts them as a custom dimension.
Later, when the user clicks the download report button (on the home page), I create one more event, downloadReportEvent with details related to the file downloaded.
window.dataLayer.push({
event: downloadReportEvent,
reportType: "XYZ",
})
reportType
is sent to GA via GTM as a parameter along with a additional parameter downloadCount
. GA accepts reportType
as custom dimension and downloadCount
as custom metric.
The problem is in the GA report values sent by 2 events are disconnected. I am not able to associate user name to download count or report type. I see all the values in the report but in separate rows. Username and role have "(not set)" value when reportType is XYZ. Similarly, reportType is "(not set)" when userName and role has "abc" and "admin" respectively.
How can I link these events together? Do I need to send common Id or something?
Thanks in advance.