A space to discuss online store customization, theme development, and Liquid templating.
Due to the recent update in Shopify (2023-4), it seems that the scope of the theme file (theme.liquid) is no longer accessible by apps. I'm looking for an alternative way to include Google script tags in my Shopify store without directly modifying the theme.liquid file.
Is there any recommended approach or workaround to include Google script tags or any other custom scripts in a Shopify store without modifying the theme.liquid file? I appreciate any suggestions or insights from the community. Thank you!
Solved! Go to the solution
This is an accepted solution.
Hi Mranoint,
If this is for your own store could you manage the Google Analytics pixel and scripts via the Google Analytics section in the Online Store Preferences on the store admin? Alternatively if it's for your own store you could manually add whatever code you need to add to the `theme.liquid` layout file from the admin code editor, rather than relying on accessing it via an API call.
Hope this helps,
Liam | Developer Advocate @ Shopify
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog
This is an accepted solution.
Hi Liam,
Thank you for your response. I understand that managing the Google Analytics pixel and scripts can be done through the Google Analytics section in the Online Store Preferences on the store admin. However, as a developer working on my app, I need to modify the theme. liquid file of my clients' stores to add specific scripts for Google Ads and also add the script of GMC (Google Merchant Center) for domain verification purposes. Modifying the theme.liquid file allows me to have more control over the customization and integration of these scripts within the store's theme.
If there are any alternative methods or best practices for achieving this without directly modifying the theme.liquid file, I would greatly appreciate your guidance.
Thank you for your assistance.
Best regards,
Manoint
This is an accepted solution.
Hi again Manoint,
Totally understand that if it's for clients this is going to be more difficult than if it's your own store. Is this an app in the Shopify App Store, or a custom app?
Liam | Developer Advocate @ Shopify
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog
This is an accepted solution.
Hi,
We are a Shopify App Store developer and currently utilize the Asset scope in our app. However, with Shopify's recent update in April 2023, the Asset scope has been deprecated. This means that the recommended approach for modifying the theme. liquid file and inserting scripts into the header have changed.
Could you please suggest an alternative to the Asset resource API? We solely rely on it to add scripts to the header of the theme.liquid file."
Hello,
In Shopify, if you're unable to directly modify the theme.liquid file to include Google script tags or custom scripts, there are a few alternative approaches you can consider:
Using a Script Tag App: Shopify provides a feature called Script Tags that allows you to add custom JavaScript to your store without modifying the theme files directly. You can create a private app or use an existing app from the Shopify App Store that enables you to add script tags to your store programmatically.
Utilizing the Script Editor App: The Script Editor app is a built-in app in Shopify's admin that allows you to add custom scripts to your store. While it primarily focuses on modifying checkout scripts, you can also add scripts to other areas of your store, such as the homepage or product pages.
Third-Party App Integration: Explore the Shopify App Store for apps that specifically cater to your needs. There might be apps available that allow you to integrate Google script tags or custom scripts into your store without modifying the theme.liquid file directly. Look for apps that provide functionality for adding custom code snippets, tracking scripts, or analytics tags.
Header/Footer Scripts: Some Shopify themes offer options to add custom scripts directly through the theme customization settings. Check if your theme provides dedicated fields for adding scripts to the header or footer section of your store. This way, you can insert your Google script tags or custom scripts without modifying the theme.liquid file.
This is an accepted solution.
Hi Mranoint,
If this is for your own store could you manage the Google Analytics pixel and scripts via the Google Analytics section in the Online Store Preferences on the store admin? Alternatively if it's for your own store you could manually add whatever code you need to add to the `theme.liquid` layout file from the admin code editor, rather than relying on accessing it via an API call.
Hope this helps,
Liam | Developer Advocate @ Shopify
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog
This is an accepted solution.
Hi Liam,
Thank you for your response. I understand that managing the Google Analytics pixel and scripts can be done through the Google Analytics section in the Online Store Preferences on the store admin. However, as a developer working on my app, I need to modify the theme. liquid file of my clients' stores to add specific scripts for Google Ads and also add the script of GMC (Google Merchant Center) for domain verification purposes. Modifying the theme.liquid file allows me to have more control over the customization and integration of these scripts within the store's theme.
If there are any alternative methods or best practices for achieving this without directly modifying the theme.liquid file, I would greatly appreciate your guidance.
Thank you for your assistance.
Best regards,
Manoint
This is an accepted solution.
Hi again Manoint,
Totally understand that if it's for clients this is going to be more difficult than if it's your own store. Is this an app in the Shopify App Store, or a custom app?
Liam | Developer Advocate @ Shopify
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog
This is an accepted solution.
Hi,
We are a Shopify App Store developer and currently utilize the Asset scope in our app. However, with Shopify's recent update in April 2023, the Asset scope has been deprecated. This means that the recommended approach for modifying the theme. liquid file and inserting scripts into the header have changed.
Could you please suggest an alternative to the Asset resource API? We solely rely on it to add scripts to the header of the theme.liquid file."
Hi Mranoint,
If you've fully explored alternative including theme app extentions and you've found that your app cannot function without the Asset API scope, you can contact Partner Support via your partner dashboard and request an exception.
Hope this helps!
Liam | Developer Advocate @ Shopify
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog
Hello Liam,
I'm interested in developing an app for the Shopify app marketplace. This app would consist more of sections and blocks, allowing merchants to easily utilize them in their stores. However, I'm facing a challenge as I need access to write on theme files, and currently, it's not possible without an exception. I've attempted to submit the exception form, but since I'm in development mode, it requires the App Store URL, which I don't have yet. How can I proceed to gain access in this development stage?
Thank you.
Hi Mmestiyak,
You'll need to contact Shopify support directly to request an exemption while your app is in development.
Liam | Developer Advocate @ Shopify
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog
but i didn't find any way to contact them directly, how can i!
In your partner dashboard, select "Support" in the right hand nav and select "Contact Partner Support"
Liam | Developer Advocate @ Shopify
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog