marketingEvents
A list of marketing events associated with the marketing app.
MarketingEventConnection arguments
- Anchor to afterafter•
The elements that come after the specified cursor.
- Anchor to beforebefore•
The elements that come before the specified cursor.
- Anchor to firstfirst•
The first
n
elements from the paginated list.- Anchor to lastlast•
The last
n
elements from the paginated list.- 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 reversereverse•BooleanDefault:false
Reverse the order of the underlying list.
- Anchor to sortKeysort•
Key MarketingEvent Default:IDSort Keys 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.
Anchor to Possible returnsPossible returns
- Anchor to edgesedges•[Marketing
Event non-nullEdge!]! The connection between the node and its parent. Each edge contains a minimum of the edge's cursor and the node.
- Anchor to nodesnodes•[Marketing
Event!]! non-null 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.
- Anchor to pageInfopage•
Info PageInfo! non-null An object that’s used to retrieve cursor information about the current page.
Retrieves a list of all marketing events
1const { admin } = await authenticate.admin(request);23const response = await admin.graphql(4 `#graphql5 query MarketingEventList {6 marketingEvents(first: 10) {7 edges {8 node {9 id10 type11 remoteId12 startedAt13 endedAt14 scheduledToEndAt15 manageUrl16 previewUrl17 utmCampaign18 utmMedium19 utmSource20 description21 marketingChannelType22 sourceAndMedium23 }24 }25 pageInfo {26 hasNextPage27 endCursor28 }29 }30 }`,31);3233const data = await response.json();34
query MarketingEventList {
marketingEvents(first: 10) {
edges {
node {
id
type
remoteId
startedAt
endedAt
scheduledToEndAt
manageUrl
previewUrl
utmCampaign
utmMedium
utmSource
description
marketingChannelType
sourceAndMedium
}
}
pageInfo {
hasNextPage
endCursor
}
}
}
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 MarketingEventList { marketingEvents(first: 10) { edges { node { id type remoteId startedAt endedAt scheduledToEndAt manageUrl previewUrl utmCampaign utmMedium utmSource description marketingChannelType sourceAndMedium } } pageInfo { hasNextPage endCursor } } }"
}'
const { admin } = await authenticate.admin(request);
const response = await admin.graphql(
`#graphql
query MarketingEventList {
marketingEvents(first: 10) {
edges {
node {
id
type
remoteId
startedAt
endedAt
scheduledToEndAt
manageUrl
previewUrl
utmCampaign
utmMedium
utmSource
description
marketingChannelType
sourceAndMedium
}
}
pageInfo {
hasNextPage
endCursor
}
}
}`,
);
const data = await response.json();
const client = new shopify.clients.Graphql({session});
const data = await client.query({
data: `query MarketingEventList {
marketingEvents(first: 10) {
edges {
node {
id
type
remoteId
startedAt
endedAt
scheduledToEndAt
manageUrl
previewUrl
utmCampaign
utmMedium
utmSource
description
marketingChannelType
sourceAndMedium
}
}
pageInfo {
hasNextPage
endCursor
}
}
}`,
});
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 MarketingEventList {
marketingEvents(first: 10) {
edges {
node {
id
type
remoteId
startedAt
endedAt
scheduledToEndAt
manageUrl
previewUrl
utmCampaign
utmMedium
utmSource
description
marketingChannelType
sourceAndMedium
}
}
pageInfo {
hasNextPage
endCursor
}
}
}
QUERY
response = client.query(query: query)
Response
JSON1{2 "marketingEvents": {3 "edges": [4 {5 "node": {6 "id": "gid://shopify/MarketingEvent/40997430",7 "type": "AD",8 "remoteId": "2345:6789",9 "startedAt": "2012-01-01T00:00:00Z",10 "endedAt": null,11 "scheduledToEndAt": null,12 "manageUrl": null,13 "previewUrl": null,14 "utmCampaign": "1234567899",15 "utmMedium": "facebook-ad",16 "utmSource": "facebook",17 "description": null,18 "marketingChannelType": "SOCIAL",19 "sourceAndMedium": "Facebook ad"20 }21 },22 {23 "node": {24 "id": "gid://shopify/MarketingEvent/56540067",25 "type": "NEWSLETTER",26 "remoteId": "222",27 "startedAt": "2024-11-17T20:47:51Z",28 "endedAt": null,29 "scheduledToEndAt": null,30 "manageUrl": "https://example.com",31 "previewUrl": "https://example.com/image.png",32 "utmCampaign": null,33 "utmMedium": null,34 "utmSource": null,35 "description": "External Marketing Activity Campaign",36 "marketingChannelType": "DISPLAY",37 "sourceAndMedium": "Display newsletter"38 }39 },40 {41 "node": {42 "id": "gid://shopify/MarketingEvent/151661601",43 "type": "NEWSLETTER",44 "remoteId": null,45 "startedAt": "2024-11-08T20:47:51Z",46 "endedAt": null,47 "scheduledToEndAt": null,48 "manageUrl": null,49 "previewUrl": null,50 "utmCampaign": "email-for-deleted-automation",51 "utmMedium": "newsletter",52 "utmSource": "email",53 "description": null,54 "marketingChannelType": "EMAIL",55 "sourceAndMedium": "Email newsletter"56 }57 },58 {59 "node": {60 "id": "gid://shopify/MarketingEvent/178808684",61 "type": "AD",62 "remoteId": null,63 "startedAt": "2012-01-01T00:00:00Z",64 "endedAt": null,65 "scheduledToEndAt": null,66 "manageUrl": null,67 "previewUrl": null,68 "utmCampaign": "google-shopping",69 "utmMedium": "ad",70 "utmSource": "google",71 "description": null,72 "marketingChannelType": "SEARCH",73 "sourceAndMedium": "Google ad"74 }75 },76 {77 "node": {78 "id": "gid://shopify/MarketingEvent/179113300",79 "type": "ABANDONED_CART",80 "remoteId": null,81 "startedAt": "2024-11-03T20:47:51Z",82 "endedAt": null,83 "scheduledToEndAt": null,84 "manageUrl": null,85 "previewUrl": null,86 "utmCampaign": "shopify_abandoned_checkout_email-1519754247",87 "utmMedium": "email",88 "utmSource": "abandoned_cart",89 "description": null,90 "marketingChannelType": "EMAIL",91 "sourceAndMedium": "Abandoned cart email"92 }93 },94 {95 "node": {96 "id": "gid://shopify/MarketingEvent/216774463",97 "type": "NEWSLETTER",98 "remoteId": "333",99 "startedAt": "2024-11-17T20:47:51Z",100 "endedAt": null,101 "scheduledToEndAt": null,102 "manageUrl": "https://example.com",103 "previewUrl": "https://example.com/image.png",104 "utmCampaign": null,105 "utmMedium": null,106 "utmSource": null,107 "description": "External Marketing Activity Ad Group",108 "marketingChannelType": "DISPLAY",109 "sourceAndMedium": "Display newsletter"110 }111 },112 {113 "node": {114 "id": "gid://shopify/MarketingEvent/264437935",115 "type": "NEWSLETTER",116 "remoteId": "444",117 "startedAt": "2024-11-17T20:47:51Z",118 "endedAt": null,119 "scheduledToEndAt": null,120 "manageUrl": "https://example.com",121 "previewUrl": "https://example.com/image.png",122 "utmCampaign": null,123 "utmMedium": null,124 "utmSource": null,125 "description": "External Marketing Activity Ad",126 "marketingChannelType": "DISPLAY",127 "sourceAndMedium": "Display newsletter"128 }129 },130 {131 "node": {132 "id": "gid://shopify/MarketingEvent/283266064",133 "type": "AD",134 "remoteId": null,135 "startedAt": "2012-01-01T00:00:00Z",136 "endedAt": null,137 "scheduledToEndAt": null,138 "manageUrl": null,139 "previewUrl": null,140 "utmCampaign": "google-shopping-4",141 "utmMedium": "ad",142 "utmSource": "google",143 "description": "Marketing Activity 4 for Snowdevil",144 "marketingChannelType": "SEARCH",145 "sourceAndMedium": "Google ad"146 }147 },148 {149 "node": {150 "id": "gid://shopify/MarketingEvent/325573600",151 "type": "POST",152 "remoteId": "1234:56779989",153 "startedAt": "2024-11-17T20:47:51Z",154 "endedAt": null,155 "scheduledToEndAt": null,156 "manageUrl": null,157 "previewUrl": null,158 "utmCampaign": "123456789000",159 "utmMedium": "facebook-post",160 "utmSource": "facebook",161 "description": null,162 "marketingChannelType": "SOCIAL",163 "sourceAndMedium": "Facebook post"164 }165 },166 {167 "node": {168 "id": "gid://shopify/MarketingEvent/425025702",169 "type": "NEWSLETTER",170 "remoteId": null,171 "startedAt": "2024-11-08T20:47:51Z",172 "endedAt": null,173 "scheduledToEndAt": null,174 "manageUrl": null,175 "previewUrl": null,176 "utmCampaign": "asdf",177 "utmMedium": "newsletter",178 "utmSource": "email",179 "description": null,180 "marketingChannelType": "EMAIL",181 "sourceAndMedium": "Email newsletter"182 }183 }184 ],185 "pageInfo": {186 "hasNextPage": true,187 "endCursor": "eyJsYXN0X2lkIjo0MjUwMjU3MDIsImxhc3RfdmFsdWUiOiI0MjUwMjU3MDIifQ=="188 }189 }190}