Anchor to webPixelweb
webPixel
query
Returns a web pixel by ID.
Anchor to Possible returnsPossible returns
- Anchor to WebPixelWeb•
Pixel The
object enables you to manage JavaScript code snippets that run on an online store and collect behavioral data for marketing campaign optimization and analytics.
Learn how to create a web pixel extension to subscribe your app to events that are emitted by Shopify.
Was this section helpful?
- Query a web pixel
- Query a web pixel by its ID
Examples
1const { admin } = await authenticate.admin(request);23const response = await admin.graphql(4 `#graphql5 query {6 webPixel {7 id8 settings9 }10 }`,11);1213const data = await response.json();14
query {
webPixel {
id
settings
}
}
curl -X POST \
https://your-development-store.myshopify.com/admin/api/2025-01/graphql.json \
-H 'Content-Type: application/json' \
-H 'X-Shopify-Access-Token: {access_token}' \
-d '{
"query": "query { webPixel { id settings } }"
}'
const { admin } = await authenticate.admin(request);
const response = await admin.graphql(
`#graphql
query {
webPixel {
id
settings
}
}`,
);
const data = await response.json();
const client = new shopify.clients.Graphql({session});
const data = await client.query({
data: `query {
webPixel {
id
settings
}
}`,
});
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
JSON1{2 "webPixel": {3 "id": "gid://shopify/WebPixel/845285844",4 "settings": "{foo2: 'bar2'}"5 }6}