I wanted to use reuse data stored in our Google Tag Manager dataLayer variable and finally found an obscure slideshow reference on how to to actually do just that.
google_tag_manager["GTM-XXXX"].dataLayer.get('key');
If you’re using Google Tag Manager you’ll already have the var dataLayer = [{}];
setup on the page. You’re presumably using dataLayer.push()
to populate it with data so now just use the get()
function to call for the keys previously pushed.