How To Add Google Analytics Tracking Code To Kartra Using GTM
--
Note: At the time of writing this in April 2020, there is no active integration for Google Analytics or GTM. This may have changed since publication. If not, the solution in this article works a treat!
If you (or your client) has moved to Kartra for its all-in-one marketing and membership solution, and like me, you want to figure out how the heck to:
- install Google Analytics for customer behaviour tracking data because the standard script install isn’t working; and/or
- easily install tracking codes without having to go back through every page you’ve ever created each time something new comes along.
The solution you’re after is: Google Tag Manager
BUT there are a few important things to note before you get carried away with the install.
Install Google Tag Manager*
Step 1: Create a free Google Tag Manager account (or login to an existing one)
Step 2: Get the GTM install scripts from the Admin > Install Google Tag Manager tab.
They will look like:
Paste this code as high in the <head> of the page
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({‘gtm.start’:
new Date().getTime(),event:’gtm.js’});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!=’dataLayer’?’&l=’+l:”;j.async=true;j.src=
‘https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,’script’,’dataLayer’,’GTM-XXXXXXX’);</script>
Paste this code immediately after the opening <body> tag
Step 3: Login to Kartra and go to My Pages
Step 4: Open one of your pages by hovering over the page and clicking the 3 dots and clicking Edit (or create a new page)
Step 5: Click Settings on the left menu and then Tracking Code
Step 6: Paste in the Google Tag Manager scripts as instructed by GTM
*BUT remove the <script> and </script> from the code snippet pasted into the head section