I get lots of questions on how to add events in Spotify. It is tough to do that without using Google Tag Manager(GTM). However, there is no space in Spotify preferences to add the GTM code. So one is stymied.
Not quite. There is a sneakier way to still do this. So let’s give it a shot.
First, add the UA-XXXXXXXX code that you get from Google Analytics into the box marked in Shopify as seen in the picture below.
To get to this page, you need to click on “Online Store” on the left Menu and then click “Preferences”.
Now, go and build a GTM container. An excellent video to show you how.
Now that you are done deploying Google Tag Manager, put a couple of events together in the container besides page view tracking.
Let’s choose scroll tracking and outbound click tracking because they can apply to pretty much every website.
For Scroll Tracking, again an excellent video by LovesData will guide you.
Now, try and put together an event for tracking outbound links. We will use another great video by Whole Whale on YouTube.
Now that you have configured both events, go ahead and pause the tag for page view tracking. Let me show you how to do that.
Now that all these steps are done, copy the code for the header from GTM. It will look like this
<!– Google Tag Manager –>
new Date().getTime(),event:’gtm.js’});var f=d.getElementsByTagName(s),
<!– End Google Tag Manager –>
Let’s go back to the Shopify interface and add the GTM code above into the yellow area shown in the image below
Click Save in the top right corner(not shown in the picture) and you are done.
This is going to make sure that all the events that are added can be fired through Google Tag Manager. The page view collection will be done by the Shopify integrated Google Analytics code. In case you are not able to add the GTM code and get an error that says, “Analytics extras is disabled for the moment. Contact support to enable editing of this field”, you do not have admin permissions. Either get them assigned to you or ask the admin to put this code for you.
This is a hack and you should not assume that it will work in your account. Please test and make sure that only one pageview tracker is firing. A surefire way to know that two trackers are firing is to see bounce rates in Google Analytics. They will immediately go to zero.
I hope this works for you. Do let me know if you have any questions.