UPDATE 4 June 2020: Instead of copying the Custom HTML code from the article, please load it from the GitHub Gist instead. Four years ago, I wrote an article on how to persist GTM's dataLayer from page to page. Unfortunately, the solution was a bit clumsy, requiring you to give specific commands for the interactions, which made it really unwieldy in the long run. Google Tag Manager still doesn't offer us a native way to persist the dataLayer array or its internal data model from one page to the other, so I thought it was about time I revisit this idea.
Last updated 2 March 2018. Every now and then you might be urged to run Google Tag Manager and/or Google Analytics locally, meaning without the benefit of a web server serving your files. In other words, you're loading an HTML file from your computer in the web browser. You can identify a locally run file by the file:/// protocol in the address bar. Now, deploying Google Tag Manager onto that file with the hopes of running Google Analytics requests locally isn't quite simple.