django-analytical
django-analytical copied to clipboard
GA not tracking logged in users, GTAG user_id seems to require a different syntax now
Hi,
Thank you for this library! I've been using this for Google Analytics but having trouble loading user-id information there.
It seems like per Google documentation the code required to send user_id
information looks like this:
gtag('config', 'G-XXXXXXXX', {'user_id': 'USER_ID'});
gtag('set', 'user_properties', { 'crm_id' : 'USER_ID' });
What the library renders is this:
gtag('set', {'user_id': 'USER_ID'});
gtag('config', 'G-XXXXXXXX');
Perhaps this is not sending the user id to GA properly? If you think this is the case, I can happily submit a PR to address this.
Ok, so I just had to wait for the data to show up in GA. Is there any way to send custom variables to GA? The current implementation doesn't seem to support it. I can submit a PR to address this. I can update to the new syntax according to the latest docs too while at it.
Sure, feel free to submit a PR to fix the implementation. Thank you!
This problem seems to be related to #189. Can you confirm?
I can confirm, that setting user_id
works without the user_properties
being set. At least according to my User-ID Coverage view, where it shows about 30% coverage.
Setting the additional variables might be a good idea. The provider can take it from the context.