# marketingEvents - admin-graphql - QUERY
Version: 2024-10
## Description
A list of marketing events associated with the marketing app.
### Access Scopes
## Arguments
* [after](/docs/api/admin-graphql/2024-10/scalars/String): String - The elements that come after the specified [cursor](https://shopify.dev/api/usage/pagination-graphql).
* [before](/docs/api/admin-graphql/2024-10/scalars/String): String - The elements that come before the specified [cursor](https://shopify.dev/api/usage/pagination-graphql).
* [first](/docs/api/admin-graphql/2024-10/scalars/Int): Int - The first `n` elements from the [paginated list](https://shopify.dev/api/usage/pagination-graphql).
* [last](/docs/api/admin-graphql/2024-10/scalars/Int): Int - The last `n` elements from the [paginated list](https://shopify.dev/api/usage/pagination-graphql).
* [query](/docs/api/admin-graphql/2024-10/scalars/String): String - A filter made up of terms, connectives, modifiers, and comparators.
| name | type | description | acceptable_values | default_value | example_use |
| ---- | ---- | ---- | ---- | ---- | ---- |
| app_id | id |
| description | string |
| id | id | Filter by `id` range. | | | - `id:1234`
- `id:>=1234`
- `id:<=1234` |
| started_at | time |
| type | string |
You can apply one or more filters to a query. Learn more about [Shopify API search syntax](https://shopify.dev/api/usage/search-syntax).
* [reverse](/docs/api/admin-graphql/2024-10/scalars/Boolean): Boolean - Reverse the order of the underlying list.
* [sortKey](/docs/api/admin-graphql/2024-10/enums/MarketingEventSortKeys): MarketingEventSortKeys - Sort the underlying list using a key. If your query is slow or returns an error, then [try specifying a sort key that matches the field used in the search](https://shopify.dev/api/usage/pagination-graphql#search-performance-considerations).
## Returns
* [edges](/docs/api/admin-graphql/2024-10/objects/MarketingEventEdge): MarketingEventEdge! The connection between the node and its parent. Each edge contains a minimum of the edge's cursor and the node.
* [nodes](/docs/api/admin-graphql/2024-10/objects/MarketingEvent): MarketingEvent! A list of nodes that are contained in MarketingEventEdge. You can fetch data about an individual node, or you can follow the edges to fetch data about a collection of related nodes. At each node, you specify the fields that you want to retrieve.
* [pageInfo](/docs/api/admin-graphql/2024-10/objects/PageInfo): PageInfo! An object that’s used to retrieve [cursor information](https://shopify.dev/api/usage/pagination-graphql) about the current page.
## Examples
### Retrieves a list of all marketing events
Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2024-10/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"query MarketingEventList { marketingEvents(first: 10) { edges { node { id type remoteId startedAt endedAt scheduledToEndAt manageUrl previewUrl utmCampaign utmMedium utmSource description marketingChannelType sourceAndMedium } } pageInfo { hasNextPage endCursor } } }\"\n}'\n"
Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: `query MarketingEventList {\n marketingEvents(first: 10) {\n edges {\n node {\n id\n type\n remoteId\n startedAt\n endedAt\n scheduledToEndAt\n manageUrl\n previewUrl\n utmCampaign\n utmMedium\n utmSource\n description\n marketingChannelType\n sourceAndMedium\n }\n }\n pageInfo {\n hasNextPage\n endCursor\n }\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 MarketingEventList {\n marketingEvents(first: 10) {\n edges {\n node {\n id\n type\n remoteId\n startedAt\n endedAt\n scheduledToEndAt\n manageUrl\n previewUrl\n utmCampaign\n utmMedium\n utmSource\n description\n marketingChannelType\n sourceAndMedium\n }\n }\n pageInfo {\n hasNextPage\n endCursor\n }\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 MarketingEventList {\n marketingEvents(first: 10) {\n edges {\n node {\n id\n type\n remoteId\n startedAt\n endedAt\n scheduledToEndAt\n manageUrl\n previewUrl\n utmCampaign\n utmMedium\n utmSource\n description\n marketingChannelType\n sourceAndMedium\n }\n }\n pageInfo {\n hasNextPage\n endCursor\n }\n }\n }`,\n);\n\nconst data = await response.json();\n"
Graphql query: "query MarketingEventList {\n marketingEvents(first: 10) {\n edges {\n node {\n id\n type\n remoteId\n startedAt\n endedAt\n scheduledToEndAt\n manageUrl\n previewUrl\n utmCampaign\n utmMedium\n utmSource\n description\n marketingChannelType\n sourceAndMedium\n }\n }\n pageInfo {\n hasNextPage\n endCursor\n }\n }\n}"
#### Graphql Input
null
#### Graphql Response
{
"data": {
"marketingEvents": {
"edges": [
{
"node": {
"id": "gid://shopify/MarketingEvent/40997430",
"type": "AD",
"remoteId": "2345:6789",
"startedAt": "2012-01-01T00:00:00Z",
"endedAt": null,
"scheduledToEndAt": null,
"manageUrl": null,
"previewUrl": null,
"utmCampaign": "1234567899",
"utmMedium": "facebook-ad",
"utmSource": "facebook",
"description": null,
"marketingChannelType": "SOCIAL",
"sourceAndMedium": "Facebook ad"
}
},
{
"node": {
"id": "gid://shopify/MarketingEvent/56540067",
"type": "NEWSLETTER",
"remoteId": "222",
"startedAt": "2024-11-17T20:47:51Z",
"endedAt": null,
"scheduledToEndAt": null,
"manageUrl": "https://example.com",
"previewUrl": "https://example.com/image.png",
"utmCampaign": null,
"utmMedium": null,
"utmSource": null,
"description": "External Marketing Activity Campaign",
"marketingChannelType": "DISPLAY",
"sourceAndMedium": "Display newsletter"
}
},
{
"node": {
"id": "gid://shopify/MarketingEvent/151661601",
"type": "NEWSLETTER",
"remoteId": null,
"startedAt": "2024-11-08T20:47:51Z",
"endedAt": null,
"scheduledToEndAt": null,
"manageUrl": null,
"previewUrl": null,
"utmCampaign": "email-for-deleted-automation",
"utmMedium": "newsletter",
"utmSource": "email",
"description": null,
"marketingChannelType": "EMAIL",
"sourceAndMedium": "Email newsletter"
}
},
{
"node": {
"id": "gid://shopify/MarketingEvent/178808684",
"type": "AD",
"remoteId": null,
"startedAt": "2012-01-01T00:00:00Z",
"endedAt": null,
"scheduledToEndAt": null,
"manageUrl": null,
"previewUrl": null,
"utmCampaign": "google-shopping",
"utmMedium": "ad",
"utmSource": "google",
"description": null,
"marketingChannelType": "SEARCH",
"sourceAndMedium": "Google ad"
}
},
{
"node": {
"id": "gid://shopify/MarketingEvent/179113300",
"type": "ABANDONED_CART",
"remoteId": null,
"startedAt": "2024-11-03T20:47:51Z",
"endedAt": null,
"scheduledToEndAt": null,
"manageUrl": null,
"previewUrl": null,
"utmCampaign": "shopify_abandoned_checkout_email-1519754247",
"utmMedium": "email",
"utmSource": "abandoned_cart",
"description": null,
"marketingChannelType": "EMAIL",
"sourceAndMedium": "Abandoned cart email"
}
},
{
"node": {
"id": "gid://shopify/MarketingEvent/216774463",
"type": "NEWSLETTER",
"remoteId": "333",
"startedAt": "2024-11-17T20:47:51Z",
"endedAt": null,
"scheduledToEndAt": null,
"manageUrl": "https://example.com",
"previewUrl": "https://example.com/image.png",
"utmCampaign": null,
"utmMedium": null,
"utmSource": null,
"description": "External Marketing Activity Ad Group",
"marketingChannelType": "DISPLAY",
"sourceAndMedium": "Display newsletter"
}
},
{
"node": {
"id": "gid://shopify/MarketingEvent/264437935",
"type": "NEWSLETTER",
"remoteId": "444",
"startedAt": "2024-11-17T20:47:51Z",
"endedAt": null,
"scheduledToEndAt": null,
"manageUrl": "https://example.com",
"previewUrl": "https://example.com/image.png",
"utmCampaign": null,
"utmMedium": null,
"utmSource": null,
"description": "External Marketing Activity Ad",
"marketingChannelType": "DISPLAY",
"sourceAndMedium": "Display newsletter"
}
},
{
"node": {
"id": "gid://shopify/MarketingEvent/283266064",
"type": "AD",
"remoteId": null,
"startedAt": "2012-01-01T00:00:00Z",
"endedAt": null,
"scheduledToEndAt": null,
"manageUrl": null,
"previewUrl": null,
"utmCampaign": "google-shopping-4",
"utmMedium": "ad",
"utmSource": "google",
"description": "Marketing Activity 4 for Snowdevil",
"marketingChannelType": "SEARCH",
"sourceAndMedium": "Google ad"
}
},
{
"node": {
"id": "gid://shopify/MarketingEvent/325573600",
"type": "POST",
"remoteId": "1234:56779989",
"startedAt": "2024-11-17T20:47:51Z",
"endedAt": null,
"scheduledToEndAt": null,
"manageUrl": null,
"previewUrl": null,
"utmCampaign": "123456789000",
"utmMedium": "facebook-post",
"utmSource": "facebook",
"description": null,
"marketingChannelType": "SOCIAL",
"sourceAndMedium": "Facebook post"
}
},
{
"node": {
"id": "gid://shopify/MarketingEvent/425025702",
"type": "NEWSLETTER",
"remoteId": null,
"startedAt": "2024-11-08T20:47:51Z",
"endedAt": null,
"scheduledToEndAt": null,
"manageUrl": null,
"previewUrl": null,
"utmCampaign": "asdf",
"utmMedium": "newsletter",
"utmSource": "email",
"description": null,
"marketingChannelType": "EMAIL",
"sourceAndMedium": "Email newsletter"
}
}
],
"pageInfo": {
"hasNextPage": true,
"endCursor": "eyJsYXN0X2lkIjo0MjUwMjU3MDIsImxhc3RfdmFsdWUiOiI0MjUwMjU3MDIifQ=="
}
}
}
}