Seems to me in groups the code is…
A. If one group is activated for GTM it processes an array with all groups
B. If no group is activated GTM code is an empty array
Therefore maybe an “if” statement of empty means don’t do anything
Then to check if there is one variable or an array
Should be an easy fix for someone who knows the code