--- title: webPixel - GraphQL Admin description: |- Returns a [web pixel](https://shopify.dev/docs/apps/build/marketing-analytics/build-web-pixels) by ID. api_version: 2025-10 api_name: admin type: query api_type: graphql source_url: html: https://shopify.dev/docs/api/admin-graphql/latest/queries/webpixel md: https://shopify.dev/docs/api/admin-graphql/latest/queries/webpixel.md --- # web​Pixel query Returns a [web pixel](https://shopify.dev/docs/apps/build/marketing-analytics/build-web-pixels) by ID. ## Arguments * id [ID](https://shopify.dev/docs/api/admin-graphql/latest/scalars/ID) The ID of the `WebPixel` object to return. *** ## Possible returns * Web​Pixel [Web​Pixel](https://shopify.dev/docs/api/admin-graphql/latest/objects/WebPixel) 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. *** ## Examples * ### Query a web pixel #### Description Retrieve a web pixel record on the store where you installed your app. This example shows how to query a web pixel's ID and \[settings object]\(https://shopify.dev/docs/apps/build/marketing-analytics/build-web-pixels#step-2-define-your-web-pixel-settings). #### Query ```graphql query { webPixel { id settings } } ``` #### cURL ```bash curl -X POST \ https://your-development-store.myshopify.com/admin/api/2025-10/graphql.json \ -H 'Content-Type: application/json' \ -H 'X-Shopify-Access-Token: {access_token}' \ -d '{ "query": "query { webPixel { id settings } }" }' ``` #### React Router ```javascript import { authenticate } from "../shopify.server"; export const loader = async ({request}) => { const { admin } = await authenticate.admin(request); const response = await admin.graphql( `#graphql query { webPixel { id settings } }`, ); const json = await response.json(); return json.data; } ``` #### Ruby ```ruby session = ShopifyAPI::Auth::Session.new( shop: "your-development-store.myshopify.com", access_token: access_token ) client = ShopifyAPI::Clients::Graphql::Admin.new( session: session ) query = <<~QUERY query { webPixel { id settings } } QUERY response = client.query(query: query) ``` #### Node.js ```javascript const client = new shopify.clients.Graphql({session}); const data = await client.query({ data: `query { webPixel { id settings } }`, }); ``` #### Response ```json { "webPixel": { "id": "gid://shopify/WebPixel/845285844", "settings": "{foo2: 'bar2'}" } } ``` * ### Query a web pixel by its ID #### Description Retrieve a \[web pixel]\(https://shopify.dev/docs/apps/build/marketing-analytics/build-web-pixels) record on the store where you installed your app. #### Query ```graphql query { webPixel(id: "gid://shopify/WebPixel/845285844") { id settings } } ``` #### cURL ```bash curl -X POST \ https://your-development-store.myshopify.com/admin/api/2025-10/graphql.json \ -H 'Content-Type: application/json' \ -H 'X-Shopify-Access-Token: {access_token}' \ -d '{ "query": "query { webPixel(id: \"gid://shopify/WebPixel/845285844\") { id settings } }" }' ``` #### React Router ```javascript import { authenticate } from "../shopify.server"; export const loader = async ({request}) => { const { admin } = await authenticate.admin(request); const response = await admin.graphql( `#graphql query { webPixel(id: "gid://shopify/WebPixel/845285844") { id settings } }`, ); const json = await response.json(); return json.data; } ``` #### Ruby ```ruby session = ShopifyAPI::Auth::Session.new( shop: "your-development-store.myshopify.com", access_token: access_token ) client = ShopifyAPI::Clients::Graphql::Admin.new( session: session ) query = <<~QUERY query { webPixel(id: "gid://shopify/WebPixel/845285844") { id settings } } QUERY response = client.query(query: query) ``` #### Node.js ```javascript const client = new shopify.clients.Graphql({session}); const data = await client.query({ data: `query { webPixel(id: "gid://shopify/WebPixel/845285844") { id settings } }`, }); ``` #### Response ```json { "webPixel": { "id": "gid://shopify/WebPixel/845285844", "settings": "{foo2: 'bar2'}" } } ``` [Open in GraphiQL](http://localhost:3457/graphiql?query=query%20%7B%0A%20%20webPixel%20%7B%0A%20%20%20%20id%0A%20%20%20%20settings%0A%20%20%7D%0A%7D) ```javascript import { authenticate } from "../shopify.server"; export const loader = async ({request}) => { const { admin } = await authenticate.admin(request); const response = await admin.graphql( `#graphql query { webPixel { id settings } }`, ); const json = await response.json(); return json.data; } ``` ##### GQL ``` query { webPixel { id settings } } ``` ##### cURL ``` curl -X POST \ https://your-development-store.myshopify.com/admin/api/2025-10/graphql.json \ -H 'Content-Type: application/json' \ -H 'X-Shopify-Access-Token: {access_token}' \ -d '{ "query": "query { webPixel { id settings } }" }' ``` ##### React Router ``` import { authenticate } from "../shopify.server"; export const loader = async ({request}) => { const { admin } = await authenticate.admin(request); const response = await admin.graphql( `#graphql query { webPixel { id settings } }`, ); const json = await response.json(); return json.data; } ``` ##### Node.js ``` const client = new shopify.clients.Graphql({session}); const data = await client.query({ data: `query { webPixel { id settings } }`, }); ``` ##### Ruby ``` session = ShopifyAPI::Auth::Session.new( shop: "your-development-store.myshopify.com", access_token: access_token ) client = ShopifyAPI::Clients::Graphql::Admin.new( session: session ) query = <<~QUERY query { webPixel { id settings } } QUERY response = client.query(query: query) ``` ## Response JSON ```json { "webPixel": { "id": "gid://shopify/WebPixel/845285844", "settings": "{foo2: 'bar2'}" } } ```