Set settings.fields.accountID value from shopify.extension.toml

Topic summary

Issue: The user couldn’t set settings.fields.accountID in shopify.extension.toml and asked if it’s auto-generated and where to get the value.

Clarification: accountID is not auto-generated. The field is defined in shopify.extension.toml to declare the setting, but its value is provided per shop via the GraphQL webPixelCreate mutation.

How to set: Include a JSON settings payload with accountID in the webPixelCreate mutation’s settings parameter (e.g., “accountID”:“234”). Use whatever account ID your application requires.

Storage and retrieval: After a successful mutation, the accountID is stored in the web pixel’s settings for that shop. Retrieve it later by querying the webPixel object.

Terms: webPixelCreate is a GraphQL mutation to create a marketing web pixel; shopify.extension.toml defines extension settings fields but does not hold per-shop values.

Status: Resolved with a clear action path—set accountID via webPixelCreate settings and read it via a webPixel query.

Summarized with AI on January 14. AI used: gpt-5.

I am following this guide: https://shopify.dev/docs/apps/marketing/pixels/getting-started#step-5-create-a-web-pixel-setting-for-the-store

I am currently on the step 5, and I need to run the GraphQL query (I don’t have any problems with that) with the accountID, but on the shopify.extension.toml file there’s only the definition of the field and cannot set the value.

My question is, where do I set this value, and if this is auto-generated, where can I retrieve it from?

Hi Ricardov,

The accountID value is not auto-generated - it’s a field that you define in your shopify.extension.toml file. It is used to store the account ID your web pixel for a specific shop.

When you run the webPixelCreate mutation in step 5, you set the accountID value in the settings parameter of the mutation. This can be any value that you need for your specific application.

Here is the example mutation from the guide:

mutation {
  webPixelCreate(webPixel: { settings: "{\"accountID\":\"234\"}" }) {
    userErrors {
      code
      field
      message
    }
    webPixel {
      settings
      id
    }
  }
}

In this example, the accountID is set to 234. You can replace 234 with the account ID that you want to use for your web pixel.

After the mutation is successful, the accountID value is stored in settings of the web pixel for the shop. You can then retrieve this value by querying the webPixel object for the shop.

Hope this helps!

1 Like