How not to add the "shop" parameter to src when creating a ScriptTag?

Solved
Kostya
Tourist
4 0 0

Hello!
I create a ScriptTag through scriptTagCreate:

gql`
mutation scriptTagCreate($input: ScriptTagInput!) {
  scriptTagCreate (input: $input) {
    userErrors {
      field
      message
    }
    scriptTag {
      src
      displayScope
    }
  }
}
`

input: {
   src: 'https://my-domain.com?text=test',
   displayScope: 'ALL',
},


But instead of the expected:

<script src="https://my-domain.com?text=test"></script>

I get:

<script src="https://my-domain.com?text=test&shop=my-shop.com"></script>


How do I create a ScriptTag without the "shop" parameter?

0 Likes
vix
Shopify Staff
Shopify Staff
534 105 103

This is an accepted solution.

 

Hi @Kostya 

 

 The shop= param is automatically appended to the final version of your script that is injected on the Shopify's liquid template. You are able to grab that param if needed and apply customizations or modify your code in any way based on the shop. You would not be able to remove that through the API. Everything you are passing looks to be correct. 

Vix | Developer Support @ 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

jandri78Dev
Shopify Partner
2 0 0

Hello , Doo you know how can I remove a scriptTag using the shopify Admin.

 

Thanks a lot!!

0 Likes
vix
Shopify Staff
Shopify Staff
534 105 103

Hey @jandri78Dev 

 

You can remove that through the API: https://shopify.dev/docs/admin-api/rest/reference/online-store/scripttag#destroy-2020-01

 

Did you mean through the admin itself? If so, you will need to go into the theme code. 

Vix | Developer Support @ 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

0 Likes