![]() Is visitor organic? (came from a search engine), Custom JavaScript Variable. This is useful when cross-domain tracking isn’t possible, you have an intermediate landing page, and you want to transfer its UTM parameters to the next page. Transfer UTM parameters from one page to another. Custom timer trigger which starts when another interaction occurs (e.g. Catch visitor’s weather data and send it to Google Analytics. Fetch the visitor’s local time and split the traffic into content groups. Track social shares made via AddThis plugin. Track clicks of Twitter buttons (embedded on your site). Updated: There is a newer guide on how to implement SEO changes via GTM. Fetch values of page’s meta tags (Custom JavaScript Variable). ![]() Anyway, here are some codes (for science). Remember, it’s always better to add SEO stuff (like schemas, meta tags, etc.) directly via code. Is the page within an Iframe? (Custom JavaScript Variable) Pro tip: I recommend bookmarking this list in case you’ll need some custom JavaScript snippets for Google Tag Manager to have within a hand’s reach. This technique is useful when you want to see what was the exact traffic source of each submission (without the need of checking Google Analytics). In fact, you can track any web interaction which is based on this technology. AJAX form tracking by taking advantage of Bounteous’ AJAX listener. In one of my blog posts, how to track form submissions, I’ve explained how to write a custom auto-event listener without coding skills. Is visitor browsing with a mobile device? (Custom JavaScript Variable) Visitor’s Variable – Screen Width (Custom JavaScript Variable) Useful for those who want to fire a particular tag after, say, 3rd page view. With every page view the counter in the cookie increases by 1. Set cookies in the visitor’s browser (then read it via 1st Party Cookie Variable). Implement Cookie consent when a new visitor lands on your page. Track Zendesk (formerly Zopim) chat widget interactions. Track Facebook comments (embedded on your site). Copy text listener tracks when someone copies a text on your website. Print listener tracks when someone prints a page of your website. Exit-intent listener fires data layer event when visitor tends to leave your website. Detect if a visitor is using incognito mode. Tab visibility tracking enables you to track when the browser tab with your website in it is hidden or visible. Track when visitor bounces back to Google’s search engine results (SERP). HTML5 audio player listener covers a bunch of generic no-name audio players that can be embedded on your site. Other possible events are: ‘buffering’, ‘play’, ‘pause’, ‘ended’, ‘error’). Mixcloud player listener tracks interactions with embedded Mixcloud player on your site (when visitor listens to 25%, 50%, 75% of the audio track. ![]() Soundcloud player listener tracks interactions with embedded Soundcloud player on your site (Play, Pause, and view 25, 50, 75, and 100% of the audio track). Custom Element Visibility Listener tracks when certain elements appear and disappear from the screen (after scrolling up or down). Hover Listener pushes events to the data layer about hover interactions that occur over the given CSS selectors in the page. Regular readers of Analytics Mania will (probably) already know a lot of these scrips but I promise that everyone will find something new. Obviously, this list is not in its final form and will grow in the future so if you haven’t yet, subscribe to Analytics Mania’s updates in the form below.ĭo you notice something missing? Do you have an awesome script hiding in your pocket? Let me know in the comments and I’ll include it on the list. For your convenience, I’ve split all codes into categories. The majority of code pieces should be added as Custom HTML tags, while a tiny fraction should be utilized as Custom JavaScript variables in GTM.Įach link will redirect you to a GTM recipe or a blog post (written by me or other authors) that provides detailed installation instructions. I present a massive list of custom JavaScript snippets for Google Tag Manager. Turns out such a thing still does not exist! Or at least I couldn’t find one online. Months went by and I noticed another growing demand among members of web analytics communities, an online library/collection where one could find various JavaScript code snippets (ready to be used in GTM ). Also, let’s not forget The Ultimate list of 120+ GTM Resources, GTM Checklist (60+ items), huge Google Tag Manager Glossary, etc. Yes, I know it’s next to impossible to surpass Simo’s blog, but hey, let me dream big □Īs a result, the library of GTM recipes was born and its popularity exceeded my biggest expectations. In 2016, when this blog saw the daylight, my vision was (and still is) to make Analytics Mania No.1 place to find Google Tag Manager resources. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |