updated code for GTM environment