Google Tag Manager

From Growth Agency Wiki
Jump to navigation Jump to search

Google Tag Manager is container used for storing a triggering scripts used for tracking.

URL: https://tagmanager.google.com/

Tag Manager Preview Mode

The new tag manager preview mode has an issue where an unpublished tag will not fail to connect to the site.
To work around this, add a tag that does not fire and publish first before making changes to test.

Tag Manager Installation

Self-Host System On-site Builder Systems Chat Systems
CS-Cart Bigcommerce CollectChat
Joomla Ecwid Jivo
Magento 1.x EKMPowershop LiveChat
Magento 2.x MyshopBlocks Tawk
Prestashop Shopify Tidio
Wordpress Squarespace ZenDesk
X-Cart Wix Zoho
Zen Cart Yell

Generic jQuery Form Listener

If there is no instructions in the wiki for a particular system and/or plugin and the form uses Ajax to submit, It may be worth trying this generic form listener.

depending on what the jQuery is called when initialized you may need to change "jQuery" to "$" in the code below.

create a custom HTML tag and change the index URL to what the URL is submitting to in the Ajax form.

<script>
jQuery(document).ready(function() {
	jQuery( document ).ajaxSuccess(function( event, xhr, settings ) {
		if (~settings.url.indexOf("/contact/form/process/")) {
			var dataLayer = window.dataLayer || [];
			dataLayer.push({'event' : 'contact-form-submitted'});
		}
	});
});
</script>


note: the form must be using the actual jQuery's Ajax method to perform the request for this to work