It might be helpful to some site owners to provide a way to exclude loading the tag for logged in users and/or certain roles. For example, on my company's site we don't load GTM for logged in users, as all authenticated users are developers. Because of that, the snippet just holds up loading the page with no benefit.
For us, it was as simple as adding the following code to the .module around line 117:
if (\Drupal::currentUser()->isAuthenticated()) {
return FALSE;
}
But obviously for the published module you'd need a config variable wrapper to turn that option on/off.
And of course some sites might have authenticated users as part of the optimize tests. So then maybe a way to exclude by role?
Just a suggestion, as there might be other site owners that could use this functionality.
Comments
Comment #2
webfaqtory commentedAdded functionality to the admin form to select which role(s) will get the snippet.