clarkwinkelmann thanks, I was just looking at that code now!
Since I'm already using the Analytics extension, and assuming that gtag allows to set the config multiple times, I guess I could do something like this (in another extension):
extend(Page.prototype, 'init', function (vdom) {
gtag('config', app.data.googleTrackingCode, {
'custom_map': {'dimension1': 'isLoggedIn'}
});
gtag('event', 'isLoggedInEvent', {'isLoggedIn': !!app.session.user });
});
(https://developers.google.com/analytics/devguides/collection/gtagjs/custom-dims-mets)
Actually, I'm going to test it now... 🙂