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

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