# WebPixel - admin - OBJECT Version: 2025-01 ## Description The `WebPixel` object enables you to manage JavaScript code snippets that run on an online store and collect [behavioral data](https://shopify.dev/docs/api/web-pixels-api/standard-events) for marketing campaign optimization and analytics. Learn how to create a [web pixel extension](https://shopify.dev/docs/apps/build/marketing-analytics/build-web-pixels) to subscribe your app to events that are emitted by Shopify. ### Access Scopes `read_pixels` access scope. ## Fields * [id](/docs/api/admin/2025-01/scalars/ID): ID! - A globally-unique ID. * [settings](/docs/api/admin/2025-01/scalars/JSON): JSON! - The [settings object](https://shopify.dev/docs/apps/build/marketing-analytics/build-web-pixels#step-2-define-your-web-pixel-settings) for the web pixel. This object specifies configuration options that control the web pixel's functionality and behavior. You can find the settings for a web pixel in `extensions/<your_extension_name>/shopify.extension.toml`. ## Connections ## Related queries * [webPixel](/docs/api/admin/2025-01/queries/webPixel) Returns a [web pixel](https://shopify.dev/docs/apps/build/marketing-analytics/build-web-pixels) by ID. ## Related mutations * [webPixelCreate](/docs/api/admin/2025-01/mutations/webPixelCreate) Activate a [web pixel extension](https://shopify.dev/docs/apps/build/marketing-analytics/build-web-pixels) by creating a web pixel record on the store where you installed your app. When you run the `webPixelCreate` mutation, Shopify validates it against the settings definition in `shopify.extension.toml`. If the `settings` input field doesn't match the schema that you defined, then the mutation fails. Learn how to define [web pixel settings](https://shopify.dev/docs/apps/build/marketing-analytics/build-web-pixels#step-2-define-your-web-pixel-settings). * [webPixelUpdate](/docs/api/admin/2025-01/mutations/webPixelUpdate) Activate a [web pixel extension](https://shopify.dev/docs/apps/build/marketing-analytics/build-web-pixels) by updating a web pixel record on the store where you installed your app. When you run the `webPixelUpdate` mutation, Shopify validates it against the settings definition in `shopify.extension.toml`. If the `settings` input field doesn't match the schema that you defined, then the mutation fails. Learn how to define [web pixel settings](https://shopify.dev/docs/apps/build/marketing-analytics/build-web-pixels#step-2-define-your-web-pixel-settings). ## Related Unions ## Examples ### Query a web pixel Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2025-01/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"query { webPixel { id settings } }\"\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: `query {\n webPixel {\n id\n settings\n }\n }`,\n});\n" Ruby example: "session = ShopifyAPI::Auth::Session.new(\n shop: \"your-development-store.myshopify.com\",\n access_token: access_token\n)\nclient = ShopifyAPI::Clients::Graphql::Admin.new(\n session: session\n)\n\nquery = <<~QUERY\n query {\n webPixel {\n id\n settings\n }\n }\nQUERY\n\nresponse = client.query(query: query)\n" Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n query {\n webPixel {\n id\n settings\n }\n }`,\n);\n\nconst data = await response.json();\n" Graphql query: "query {\n webPixel {\n id\n settings\n }\n}" #### Graphql Input null #### Graphql Response { "data": { "webPixel": { "id": "gid://shopify/WebPixel/845285844", "settings": "{foo2: 'bar2'}" } } } ### Query a web pixel by its ID Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2025-01/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"query { webPixel(id: \\\"gid://shopify/WebPixel/845285844\\\") { id settings } }\"\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: `query {\n webPixel(id: \"gid://shopify/WebPixel/845285844\") {\n id\n settings\n }\n }`,\n});\n" Ruby example: "session = ShopifyAPI::Auth::Session.new(\n shop: \"your-development-store.myshopify.com\",\n access_token: access_token\n)\nclient = ShopifyAPI::Clients::Graphql::Admin.new(\n session: session\n)\n\nquery = <<~QUERY\n query {\n webPixel(id: \"gid://shopify/WebPixel/845285844\") {\n id\n settings\n }\n }\nQUERY\n\nresponse = client.query(query: query)\n" Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n query {\n webPixel(id: \"gid://shopify/WebPixel/845285844\") {\n id\n settings\n }\n }`,\n);\n\nconst data = await response.json();\n" Graphql query: "query {\n webPixel(id: \"gid://shopify/WebPixel/845285844\") {\n id\n settings\n }\n}" #### Graphql Input null #### Graphql Response { "data": { "webPixel": { "id": "gid://shopify/WebPixel/845285844", "settings": "{foo2: 'bar2'}" } } }