--- title: marketingEvent - GraphQL Admin description: Returns a `MarketingEvent` resource by ID. api_version: unstable api_name: admin source_url: html: https://shopify.dev/docs/api/admin-graphql/unstable/queries/marketingevent md: https://shopify.dev/docs/api/admin-graphql/unstable/queries/marketingevent.md --- # marketing​Event query Returns a `MarketingEvent` resource by ID. ## Arguments * id [ID!](https://shopify.dev/docs/api/admin-graphql/unstable/scalars/ID) required The ID of the `MarketingEvent` to return. *** ## Possible returns * Marketing​Event [Marketing​Event](https://shopify.dev/docs/api/admin-graphql/unstable/objects/MarketingEvent) Represents actions that market a merchant's store or products. * app [App!](https://shopify.dev/docs/api/admin-graphql/unstable/objects/App) non-null The app that the marketing event is attributed to. * channel​Handle [String](https://shopify.dev/docs/api/admin-graphql/unstable/scalars/String) The unique string identifier of the channel to which this activity belongs. For the correct handle for your channel, contact your partner manager. * description [String](https://shopify.dev/docs/api/admin-graphql/unstable/scalars/String) A human-readable description of the marketing event. * ended​At [Date​Time](https://shopify.dev/docs/api/admin-graphql/unstable/scalars/DateTime) The date and time when the marketing event ended. * id [ID!](https://shopify.dev/docs/api/admin-graphql/unstable/scalars/ID) non-null A globally-unique ID. * legacy​Resource​Id [Unsigned​Int64!](https://shopify.dev/docs/api/admin-graphql/unstable/scalars/UnsignedInt64) non-null The ID of the corresponding resource in the REST Admin API. * manage​Url [URL](https://shopify.dev/docs/api/admin-graphql/unstable/scalars/URL) The URL where the marketing event can be managed. * marketing​Channel​Type [Marketing​Channel](https://shopify.dev/docs/api/admin-graphql/unstable/enums/MarketingChannel) The medium through which the marketing activity and event reached consumers. This is used for reporting aggregation. * preview​Url [URL](https://shopify.dev/docs/api/admin-graphql/unstable/scalars/URL) The URL where the marketing event can be previewed. * remote​Id [String](https://shopify.dev/docs/api/admin-graphql/unstable/scalars/String) An optional ID that helps Shopify validate engagement data. * scheduled​To​End​At [Date​Time](https://shopify.dev/docs/api/admin-graphql/unstable/scalars/DateTime) The date and time when the marketing event is scheduled to end. * source​And​Medium [String!](https://shopify.dev/docs/api/admin-graphql/unstable/scalars/String) non-null Where the `MarketingEvent` occurred and what kind of content was used. Because `utmSource` and `utmMedium` are often used interchangeably, this is based on a combination of `marketingChannel`, `referringDomain`, and `type` to provide a consistent representation for any given piece of marketing regardless of the app that created it. * started​At [Date​Time!](https://shopify.dev/docs/api/admin-graphql/unstable/scalars/DateTime) non-null The date and time when the marketing event started. * type [Marketing​Tactic!](https://shopify.dev/docs/api/admin-graphql/unstable/enums/MarketingTactic) non-null The marketing event type. * utm​Campaign [String](https://shopify.dev/docs/api/admin-graphql/unstable/scalars/String) The name of the marketing campaign. * utm​Medium [String](https://shopify.dev/docs/api/admin-graphql/unstable/scalars/String) The medium that the marketing campaign is using. Example values: `cpc`, `banner`. * utm​Source [String](https://shopify.dev/docs/api/admin-graphql/unstable/scalars/String) The referrer of the marketing event. Example values: `google`, `newsletter`. * channel [Marketing​Channel](https://shopify.dev/docs/api/admin-graphql/unstable/enums/MarketingChannel) Deprecated * target​Type​Display​Text [String!](https://shopify.dev/docs/api/admin-graphql/unstable/scalars/String) non-nullDeprecated *** ## Examples * ### Retrieves a single marketing event #### Query ```graphql query MarketingEventShow { marketingEvent(id: "gid://shopify/MarketingEvent/425025702") { id type remoteId startedAt endedAt scheduledToEndAt manageUrl previewUrl utmCampaign utmMedium utmSource description marketingChannelType sourceAndMedium } } ``` #### cURL ```bash curl -X POST \ https://your-development-store.myshopify.com/admin/api/unstable/graphql.json \ -H 'Content-Type: application/json' \ -H 'X-Shopify-Access-Token: {access_token}' \ -d '{ "query": "query MarketingEventShow { marketingEvent(id: \"gid://shopify/MarketingEvent/425025702\") { id type remoteId startedAt endedAt scheduledToEndAt manageUrl previewUrl utmCampaign utmMedium utmSource description marketingChannelType sourceAndMedium } }" }' ``` #### 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 MarketingEventShow { marketingEvent(id: "gid://shopify/MarketingEvent/425025702") { id type remoteId startedAt endedAt scheduledToEndAt manageUrl previewUrl utmCampaign utmMedium utmSource description marketingChannelType sourceAndMedium } }`, ); 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 MarketingEventShow { marketingEvent(id: "gid://shopify/MarketingEvent/425025702") { id type remoteId startedAt endedAt scheduledToEndAt manageUrl previewUrl utmCampaign utmMedium utmSource description marketingChannelType sourceAndMedium } } QUERY response = client.query(query: query) ``` #### Node.js ```javascript const client = new shopify.clients.Graphql({session}); const data = await client.query({ data: `query MarketingEventShow { marketingEvent(id: "gid://shopify/MarketingEvent/425025702") { id type remoteId startedAt endedAt scheduledToEndAt manageUrl previewUrl utmCampaign utmMedium utmSource description marketingChannelType sourceAndMedium } }`, }); ``` #### Response ```json { "marketingEvent": { "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" } } ``` ## Retrieves a single marketing event [Open in GraphiQL](http://localhost:3457/graphiql?query=query%20MarketingEventShow%20%7B%0A%20%20marketingEvent\(id%3A%20%22gid%3A%2F%2Fshopify%2FMarketingEvent%2F425025702%22\)%20%7B%0A%20%20%20%20id%0A%20%20%20%20type%0A%20%20%20%20remoteId%0A%20%20%20%20startedAt%0A%20%20%20%20endedAt%0A%20%20%20%20scheduledToEndAt%0A%20%20%20%20manageUrl%0A%20%20%20%20previewUrl%0A%20%20%20%20utmCampaign%0A%20%20%20%20utmMedium%0A%20%20%20%20utmSource%0A%20%20%20%20description%0A%20%20%20%20marketingChannelType%0A%20%20%20%20sourceAndMedium%0A%20%20%7D%0A%7D) ##### GQL ```graphql query MarketingEventShow { marketingEvent(id: "gid://shopify/MarketingEvent/425025702") { id type remoteId startedAt endedAt scheduledToEndAt manageUrl previewUrl utmCampaign utmMedium utmSource description marketingChannelType sourceAndMedium } } ``` ##### cURL ```bash curl -X POST \ https://your-development-store.myshopify.com/admin/api/unstable/graphql.json \ -H 'Content-Type: application/json' \ -H 'X-Shopify-Access-Token: {access_token}' \ -d '{ "query": "query MarketingEventShow { marketingEvent(id: \"gid://shopify/MarketingEvent/425025702\") { id type remoteId startedAt endedAt scheduledToEndAt manageUrl previewUrl utmCampaign utmMedium utmSource description marketingChannelType sourceAndMedium } }" }' ``` ##### 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 MarketingEventShow { marketingEvent(id: "gid://shopify/MarketingEvent/425025702") { id type remoteId startedAt endedAt scheduledToEndAt manageUrl previewUrl utmCampaign utmMedium utmSource description marketingChannelType sourceAndMedium } }`, ); const json = await response.json(); return json.data; } ``` ##### Node.js ```javascript const client = new shopify.clients.Graphql({session}); const data = await client.query({ data: `query MarketingEventShow { marketingEvent(id: "gid://shopify/MarketingEvent/425025702") { id type remoteId startedAt endedAt scheduledToEndAt manageUrl previewUrl utmCampaign utmMedium utmSource description marketingChannelType sourceAndMedium } }`, }); ``` ##### 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 MarketingEventShow { marketingEvent(id: "gid://shopify/MarketingEvent/425025702") { id type remoteId startedAt endedAt scheduledToEndAt manageUrl previewUrl utmCampaign utmMedium utmSource description marketingChannelType sourceAndMedium } } QUERY response = client.query(query: query) ``` ## Response JSON ```json { "marketingEvent": { "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" } } ```