Anchor to eventsCountevents
eventsCount
query
Count of events. Limited to a maximum of 10000.
Anchor to Arguments
Arguments
- Anchor to queryquery•
A filter made up of terms, connectives, modifiers, and comparators. You can apply one or more filters to a query. Learn more about Shopify API search syntax.
- Anchor to comments•boolean
Whether or not to include comment-events in your search, passing
false
will exclude comment-events, any other value will include comment-events.false
true
- Anchor to created_at•time
Filter by the date and time when the event happened.
created_at:>2020-10-21
created_at:<now
- Anchor to subject_type•string
The resource type affected by this event. See EventSubjectType for possible values.
PRODUCT_VARIANT
PRODUCT
COLLECTION
Example:
Example:
Example:
Was this section helpful?
Anchor to Possible returnsPossible returns
- Anchor to CountCount•
Details for count of elements.
Was this section helpful?
- Retrieve the amount of events after a given time
- Retrieve the amount of product events, including comment events
- Retrieves a count of events
Examples
const { admin } = await authenticate.admin(request);
const response = await admin.graphql(
`#graphql
query {
eventsCount(query: "created_at:>=2024-01-01") {
count
precision
}
}`,
);
const data = await response.json();
query {
eventsCount(query: "created_at:>=2024-01-01") {
count
precision
}
}
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 { eventsCount(query: \"created_at:>=2024-01-01\") { count precision } }"
}'
const { admin } = await authenticate.admin(request);
const response = await admin.graphql(
`#graphql
query {
eventsCount(query: "created_at:>=2024-01-01") {
count
precision
}
}`,
);
const data = await response.json();
const client = new shopify.clients.Graphql({session});
const data = await client.query({
data: `query {
eventsCount(query: "created_at:>=2024-01-01") {
count
precision
}
}`,
});
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 {
eventsCount(query: "created_at:>=2024-01-01") {
count
precision
}
}
QUERY
response = client.query(query: query)
Response
JSON{
"eventsCount": {
"count": 28,
"precision": "EXACT"
}
}