# MarketingEvent - admin-graphql - OBJECT Version: 2024-10 ## Description Represents actions that market a merchant's store or products. ### Access Scopes `read_marketing_events` access scope. ## Fields * [app](/docs/api/admin-graphql/2024-10/objects/App): App! - The app that the marketing event is attributed to. * [channel](/docs/api/admin-graphql/2024-10/enums/MarketingChannel): MarketingChannel - The medium through which the marketing activity and event reached consumers. This is used for reporting aggregation. * [channelHandle](/docs/api/admin-graphql/2024-10/scalars/String): 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](/docs/api/admin-graphql/2024-10/scalars/String): String - A human-readable description of the marketing event. * [endedAt](/docs/api/admin-graphql/2024-10/scalars/DateTime): DateTime - The date and time when the marketing event ended. * [id](/docs/api/admin-graphql/2024-10/scalars/ID): ID! - A globally-unique ID. * [legacyResourceId](/docs/api/admin-graphql/2024-10/scalars/UnsignedInt64): UnsignedInt64! - The ID of the corresponding resource in the REST Admin API. * [manageUrl](/docs/api/admin-graphql/2024-10/scalars/URL): URL - The URL where the marketing event can be managed. * [marketingChannelType](/docs/api/admin-graphql/2024-10/enums/MarketingChannel): MarketingChannel - The medium through which the marketing activity and event reached consumers. This is used for reporting aggregation. * [previewUrl](/docs/api/admin-graphql/2024-10/scalars/URL): URL - The URL where the marketing event can be previewed. * [remoteId](/docs/api/admin-graphql/2024-10/scalars/String): String - An optional ID that helps Shopify validate engagement data. * [scheduledToEndAt](/docs/api/admin-graphql/2024-10/scalars/DateTime): DateTime - The date and time when the marketing event is scheduled to end. * [sourceAndMedium](/docs/api/admin-graphql/2024-10/scalars/String): String! - 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. * [startedAt](/docs/api/admin-graphql/2024-10/scalars/DateTime): DateTime! - The date and time when the marketing event started. * [targetTypeDisplayText](/docs/api/admin-graphql/2024-10/scalars/String): String! - The display text for the marketing event type. * [type](/docs/api/admin-graphql/2024-10/enums/MarketingTactic): MarketingTactic! - The marketing event type. * [utmCampaign](/docs/api/admin-graphql/2024-10/scalars/String): String - The name of the marketing campaign. * [utmMedium](/docs/api/admin-graphql/2024-10/scalars/String): String - The medium that the marketing campaign is using. Example values: `cpc`, `banner`. * [utmSource](/docs/api/admin-graphql/2024-10/scalars/String): String - The referrer of the marketing event. Example values: `google`, `newsletter`. ## Connections ## Related queries * [marketingEvent](/docs/api/admin-graphql/2024-10/queries/marketingEvent) Returns a MarketingEvent resource by ID. * [marketingEvents](/docs/api/admin-graphql/2024-10/queries/marketingEvents) A list of marketing events associated with the marketing app. ## Related mutations ## Related Unions ## Examples ### Retrieves a single marketing event 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 MarketingEventShow { marketingEvent(id: \\\"gid://shopify/MarketingEvent/425025702\\\") { id type remoteId startedAt endedAt scheduledToEndAt manageUrl previewUrl utmCampaign utmMedium utmSource description marketingChannelType sourceAndMedium } }\"\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: `query MarketingEventShow {\n marketingEvent(id: \"gid://shopify/MarketingEvent/425025702\") {\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});\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 MarketingEventShow {\n marketingEvent(id: \"gid://shopify/MarketingEvent/425025702\") {\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 }\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 MarketingEventShow {\n marketingEvent(id: \"gid://shopify/MarketingEvent/425025702\") {\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);\n\nconst data = await response.json();\n" Graphql query: "query MarketingEventShow {\n marketingEvent(id: \"gid://shopify/MarketingEvent/425025702\") {\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}" #### Graphql Input null #### Graphql Response { "data": { "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" } } }