Allow GTM override

I needed this fix for a recent project, so I thought it might be worth committing back. 

While analytics is often implemented through GTM, this isn't necessarily the case, and the current version doesn't work on pages where GTM is included but doesn't implement GA.