Profile cover photo
Profile photo
Andy Scott
Digital Analytics Guy
Digital Analytics Guy
About
Posts

Post has shared content
After searching various corners of the Internet, I've compiled a list of ready-to-use JavaScript code snippets for Google Tag Manager (links to GTM recipes or blog posts). Let me know if you notice something missing. This list/collection is far from complete.

Happy tagging!
Add a comment...

Post has shared content
Hi All,

We have a product array in the data layer on a search results page. Within this array, we have the product name, product ID and product price.

Question - We have a 3rd party HTML script that needs to collect the product ID's of all the products in the array. How would I go by creating a variable to only show all the product ID values within the array?

The Facebook pixel is a good example, where you need to pull in numerous content ID's.

Any help would be appreciated.

Cheers,
Tiaan
Add a comment...

Post has shared content
A useful resource (especially for beginners) - Google Tag Manager Glossary (with more than 160 terms). You can also download it as PDF.
Add a comment...

Post has shared content
So many good tips...so helpful.
100+ Google Tag Manager learnings

In my latest article, I've compiled 100 short tips / learnings I've accumulated over the years. Some of them are simple and obvious, and some are more obscure things you only learn when running into them head-on.

#gde #googletagmanager #blogpost
Add a comment...

Post has shared content
What is the best way to return a default value if a GTM variable is undefined?

I looked on Stack overflow and there seems to be a wide variety of ways to check for undefined, but nothing thats concrete.

Here is my go from within a custom HTML Tag:

var searchCatFromGTM = {{searchCategory}};
var searchCat = searchCatFromGTM == undefined ? "No Category Defined": searchCatFromGTM;
console.log(searchCat);

Any better way to do this?

Add a comment...

Post has shared content
holy crap this is exactly what i wanted to do the moment both arrive
Add a comment...

Post has shared content
Just sharing my generic GTM containers templates/recipes...

The generic login for these is:
username: coolgtmstuff@gmail.com
password: philrulesgtm8

Or if the login does not work you can import using these links...

Generic CMS:
https://www.dropbox.com/s/woak00y749jk36e/AUTO-EVENTS%20-%20NEW%20interface.json?dl=0

Wordpress (mapped to GTM for Wordpress)
https://www.dropbox.com/s/qgzd0lny273j100/WORDPRESS%20TEMPLATE%20-%20NEW%20interface.json?dl=0
https://en-gb.wordpress.org/plugins/duracelltomi-google-tag-manager/

Magento (mapped to Qubit dataLayer)
https://www.dropbox.com/s/rc2ew58w3ls3quk/MAGENTO%20-%20mapped%20to%20qubit%20-%20NEW%20interface.json?dl=0
https://www.magentocommerce.com/magento-connect/qubit-universal-variable.html

Drupal (mapped to plugin)
https://www.dropbox.com/s/uoa19tp8zjt4c03/DRUPAL%20-%20work%20in%20progress%20-%20NEW%20interface.json?dl=0
https://www.drupal.org/project/google_tag
https://www.drupal.org/project/datalayer
https://www.drupal.org/project/commerce_google_tag_manager

Bootstrap
https://www.dropbox.com/s/bly0i85i134qe6a/BOOTSTRAP%20-%20DEMO%20SITE%20-%20NEW%20interface.json?dl=0

Angulartics (mapped to plugin)
https://www.dropbox.com/s/bbkchg7m32eu06t/Angulartics.json?dl=0
http://angulartics.github.io/

AMP (new)
https://www.dropbox.com/s/01ccor3fmbx6hfr/AMP.json?dl=0

APP - iOS FireBase (new)
https://www.dropbox.com/s/8f1s561xe4ehqop/APP%20-%20NEW%20interface%20-%20FireBase.json?dl=0

APP - Legacy
https://www.dropbox.com/s/8lzc5o7awwtijat/APP%20-%20NEW%20interface.json?dl=0

JSONLD
https://www.dropbox.com/s/d7ti8fv8vfhdf3e/JSON%20-ld%20-%20NEW%20interface.json?dl=0

Yandex.Metrika
https://www.dropbox.com/s/b38649b2o0izqm3/Yandex.Metrika%20-%20NEW%20interface.json?dl=0

Thanks

Phil.
Photo
Add a comment...

Post has shared content
Critical knowledge right here
10 JavaScript Concepts for Web Analytics Implementation

Anyone working with the web should have a working knowledge of JavaScript. There's no excuses! If you happen to work with web analytics, I dare say there's no other more important technical skill.

In this article, I list 10 JavaScript concepts which I consider absolutely vital for anyone working with analytics implementations to grasp.

#gde   #blogpost   #googleanalytics   #googletagmanager  
Add a comment...

Post has shared content
Container Snippet placement recommendation now officially changed to <head>

FINALLY! The recommendation for where to put the Google Tag Manager container snippet has changed. The official word is now to put it in <head>.

This is significant, because <head> is the correct place for all asynchronously loading libraries, but GTM's documentation had been steadfast in recommending it to be placed in the beginning of <body>. With this change, the library will start loading earlier in the page load sequence, and as a result your tracking accuracy will improve.

If you want search console verification to still work, and if you care about JavaScript-less users, you'll need to leave the <noscript></noscript> block in the beginning of <body>.

https://developers.google.com/tag-manager/quickstart

H/T +Scott Herman
Photo
Add a comment...

Post has shared content
Table variable generator, by the GTM community resident Stephen Harris.
Add a comment...
Wait while more posts are being loaded