-
Notifications
You must be signed in to change notification settings - Fork 365
Best practices for third party tracking snippets that include single JavaScript files and JavaScript blocks? #1079
Comments
Not sure if this is helpful but we recently moved all of our third-party scripts on sites to Google Tag Manager which gives you and the client a central place to manage everything without needing to re-deploy the theme. You can also specify when and how to invoke the scripts which keep things performant. |
It's helpful yet also poses more questions. How are you integrating GTM? |
@cfxd This does not have anything to do with Slate, and it's more of a general Shopify development question. The Shopify Community is a great place to ask questions like this. Although I will say that this is by far the best guide I have found to integrate GTM for shops that are not Shopify Plus accounts. |
@jonathanmoore thank you for the link. I do think it has something to do with Slate since I'm asking about best practices. If I wasn't working with Slate then I could just, as most third party integration guides suggest, paste that code right before |
@cfxd I would second the use of GTM for this scenario. I definitely can relate to the pain of having to keep up with all the 3rd party scripts, and while dropping them in With GTM containers though you can really fine tune script behavior, add triggers, specific page loading, etc. The one drawback that immediately comes to mind here is that you lose Liquid templating with the scripts by removing them from your theme. However you could easily add just about any variable to your data layer with JS and use them in GTM however you need. |
Problem
Best practices are unclear for installing the many third party tracking apps offered by Shopify vendors. These scripts are similar to Google Analytics where a
<script>
tag links to an external third party single JS file, and a subsequent block of code then invokes a function, method, or object/class/variable from the JS file.Saving these single JS files locally seems rather tedious and then charges developers with keeping the vendor file updated, and just adding them to a template/section/snippet could end up render blocking.
One example is Klaviyo's back in stock flow snippet:
The text was updated successfully, but these errors were encountered: