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

Solved

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

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?

Accepted Solution (1)

vix
Shopify Staff
541 103 122

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. 

To learn more visit the Shopify Help Center or the Community Blog.

View solution in original post

Replies 3 (3)

vix
Shopify Staff
541 103 122

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. 

To learn more visit the Shopify Help Center or the Community Blog.

jandri78Dev
Shopify Partner
2 0 0

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

 

Thanks a lot!!

vix
Shopify Staff
541 103 122

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. 

To learn more visit the Shopify Help Center or the Community Blog.