It's easy to track events in your Shopify store, using the Gist JavaScript code snippet. Here are the steps you need to do:
1. Copy the Gist JavaScript code from the Settings > General > Tracking code page.
Gist JavaScript Code
Here is the Gist JS code snippet which you simply need to paste in your website code, before the closing </head> tag.
<!-- start Gist JS code--> <script>(function(d,h,w){var gist=w.gist=w.gist||[];gist.methods=['trackPageView','identify','track','setAppId'];gist.factory=function(t){return function(){var e=Array.prototype.slice.call(arguments);e.unshift(t);gist.push(e);return gist;}};for(var i=0;i<gist.methods.length;i++){var c=gist.methods[i];gist[c]=gist.factory(c)}s=d.createElement('script'),s.src="https://widget.getgist.com",s.async=!0,e=d.getElementsByTagName(h)[0],e.appendChild(s),s.addEventListener('load',function(e){},!1),gist.setAppId("WORKSPACE_ID"),gist.trackPageView()})(document,'head',window);</script> <!-- end Gist JS code-->
IMPORTANT: Remember to replace “WORKSPACE_ID” with your Workspace ID.
2. Log into your Shopify admin dashboard. In the sidebar menu on the left, select Online Store > Themes
3. Towards the right side of your screen, select Actions > Edit code
4. In this screen, select the theme.liquid file for your theme
5. Paste your Gist tracking code just before the </body> tag in this file
6. Click Save in the upper-right corner
That's it! You've installed Gist on your Shopify store.
Tracking customers in Gist
To track your customers in Gist, you can add the following code right beneath the tracking you just installed.
<script> {% if customer %} gist.identify({ "email": '{{customer.email}}', "name": '{{customer.name}}' }); {% endif %} </script>
Learn more about the Gist identify call. And learn more about other Shopify properties that you can send to Gist.
If you need any assistance with this, or if you run into problems anywhere in this process, feel free to reach out to us on live chat.
Need Help?
If you have any further questions, please start a Live Chat. Just "Click" on the Chat Icon in the lower right corner to talk with our support team.