# MarketingEvent

Marketing events represent actions taken by your app, on behalf of the merchant, to market products, collections, discounts, pages, blog posts, and other features. These actions target multiple potential customers, rather than specific individuals. For example, you should model your marketing event at the email campaign level, rather than on a per-email basis.

Merchants get value from marketing events because they help them understand sales and traffic attribution. Implementing marketing events for your app is beneficial because it enables Shopify to surface your app in the Shopify admin in ways that are helpful to merchants. Examples of marketing events include an ad campaign that drives multiple potential customers to a product page, or an email marketing campaign advertising a discount code.

Marketing events can be created for email campaigns, affiliate links, advertisements, and other common marketing tactics. Marketing events include the event_type and marketing_channel properties that help Shopify to rank your app and surface it in the Shopify admin in ways that are useful to merchants. Traffic and order attribution for your app is handled by providing UTM parameters with your marketing events. The same UTM parameters are also used in the links provided in the marketing event.

Engagements can also be added to marketing events to give merchants more insight into how potential customers interact with your marketing events. For example, engagements for ad campaigns can include clicks, shares, and comments. Creating engagements is optional, and not all marketing events include engagements.

## Resource Properties ### MarketingEvent * remote_id: An optional remote identifier for a marketing event. The remote identifier lets Shopify validate engagement data. * Type: x-string * Example: "123abc" * event_type: The type of marketing event. Valid values: ad, post, message, retargeting, transactional, affiliate, loyalty, newsletter, abandoned_cart.

Note

If there are values that you’d like to use for event_type that are not in the list above, then please share your request in the Shopify Community APIs and SDKs discussion board providing as much detail as possible. Our approach is to be more structured than using freeform text, but to still allow for categorization of most types of marketing actions.

* Type: x-string * Example: "ad" * marketing_channel: The channel that your marketing event will use. Valid values: search, display, social, email, referral. * Type: x-string * Example: "social" * paid: Whether the event is paid or organic. * Type: x-string * Example: true * referring_domain: The destination domain of the marketing event. Required if the marketing_channel is set to search or social. * Type: x-string * Example: "facebook.com" * budget: The budget of the ad campaign. * Type: x-string * Example: 10.75 * currency: The currency for the budget. Required if budget is specified. * Type: x-string * Example: "USD" * budget_type: The type of the budget. Required if budget is specified. Valid values: daily, lifetime.' * Type: x-string * Example: "lifetime" * started_at: The time when the marketing action was started. * Type: x-string * Example: "2025-01-15T11:56:18-04:00" * scheduled_to_end_at: For events with a duration, the time when the event was scheduled to end. * Type: x-string * Example: "2025-01-22T11:56:18-04:00" * ended_at: For events with a duration, the time when the event actually ended. * Type: x-string * Example: "2025-01-20T11:56:18-04:00" * UTM parameters:

The UTM parameters used in the links provided in the marketing event. Values must be unique and should not be url-encoded.

To do traffic or order attribution you must at least define utm_campaign, utm_source, and utm_medium.

* Type: x-string * Example: {"marketing_event"=>{"utm_campaign"=>"CanadaDay2025", "utm_source"=>"facebook", "utm_medium"=>"cpc"}} * description: A description of the marketing event. * Type: x-string * Example: "Facebook carousel ad \#{Time.now.utc.year}" * manage_url: A link to manage the marketing event. In most cases, this links to the app that created the event. * Type: x-string * Example: "https://mymarketingapp.com/ad/1234" * preview_url: A link to the live version of the event, or to a rendered preview in the app that created it. * Type: x-string * Example: "https://www.facebook.com/123456/" * marketed_resources: A list of the items that were marketed in the marketing event. Includes the type and id of each item. Valid values for type are: * Type: x-string * Example: [{"type"=>"product", "id"=>12345}] ## Retrieves a list of all marketing events Retrieves a list of all marketing events. Note: This endpoint implements pagination by using links that are provided in the response header. To learn more, refer to Make paginated requests to the REST Admin API. ### Endpoint /admin/api/#{api_version}/marketing_events.json (GET) ### Parameters * api_version (required): * limit: The amount of results to return. * offset: The number of marketing events to skip. ### Responses #### 200 Retrieves a list of all marketing events Examples: ##### Retrieve all marketing events Request: ``` GET /admin/api/unstable/marketing_events.json ``` Response: ``` HTTP/1.1 200 OK {"marketing_events":[{"id":998730532,"event_type":"post","remote_id":"12345678","started_at":"2025-01-15T10:56:18-05:00","ended_at":null,"scheduled_to_end_at":null,"budget":"10.11","currency":"GBP","manage_url":null,"preview_url":null,"utm_campaign":"1234567890","utm_source":"facebook","utm_medium":"facebook-post","budget_type":"daily","description":null,"marketing_channel":"social","paid":false,"referring_domain":"facebook.com","breadcrumb_id":null,"marketing_activity_id":null,"admin_graphql_api_id":"gid://shopify/MarketingEvent/998730532","marketed_resources":[]}]} ``` ## Creates a marketing event

Marketing events can be created to track ad campaigns that target a specific time of year. For example, a marketing event can be created to track a Facebook ad campaign for Christmas 2022. When creating the marketing event, the body of the request includes the UTM parameters that must be included in the links provided in the marketing event. Each marketing event also includes the event_type and marketing_channel properties that help Shopify to rank your app and surface it within Shopify admin.


After a marketing event is created in Shopify, you can start to drive traffic to Shopify. Make sure that the links for the marketing event contain the same UTM parameters that were defined in the marketing event. For example, marketing activities for the Christmas 2022 ad campaign would use the following URL convention:


https://storename.com/product?utm_source=facebook&utm_medium=cpc&utm_campaign=Christmas2022-12142018

### Endpoint /admin/api/#{api_version}/marketing_events.json (POST) ### Parameters * api_version (required): ### Responses #### 201 Creates a marketing event Examples: ##### Create a marketing event Request: ``` POST /admin/api/unstable/marketing_events.json {"marketing_event":{"started_at":"2025-12-15","utm_campaign":"Christmas2025","utm_source":"facebook","utm_medium":"cpc","event_type":"ad","referring_domain":"facebook.com","marketing_channel":"social","paid":true}} ``` Response: ``` HTTP/1.1 201 Created {"marketing_event":{"id":1069063883,"event_type":"ad","remote_id":null,"started_at":"2025-12-15T00:00:00-05:00","ended_at":null,"scheduled_to_end_at":null,"budget":null,"currency":null,"manage_url":null,"preview_url":null,"utm_campaign":"Christmas2025","utm_source":"facebook","utm_medium":"cpc","budget_type":null,"description":null,"marketing_channel":"social","paid":true,"referring_domain":"facebook.com","breadcrumb_id":null,"marketing_activity_id":1063897333,"admin_graphql_api_id":"gid://shopify/MarketingEvent/1069063883","marketed_resources":[]}} ``` ## Retrieves a count of all marketing events Retrieves a count of all marketing events ### Endpoint /admin/api/#{api_version}/marketing_events/count.json (GET) ### Parameters * api_version (required): ### Responses #### 200 Retrieves a count of all marketing events Examples: ##### Retrieve a count all marketing events Request: ``` GET /admin/api/unstable/marketing_events/count.json ``` Response: ``` HTTP/1.1 200 OK {"count":1} ``` ## Retrieves a single marketing event Retrieves a single marketing event ### Endpoint /admin/api/#{api_version}/marketing_events/{marketing_event_id}.json (GET) ### Parameters * api_version (required): * marketing_event_id (required): ### Responses #### 200 Retrieves a single marketing event Examples: ##### Retrieve a single marketing event by its ID Request: ``` GET /admin/api/unstable/marketing_events/998730532.json ``` Response: ``` HTTP/1.1 200 OK {"marketing_event":{"id":998730532,"event_type":"post","remote_id":"12345678","started_at":"2025-01-15T10:56:18-05:00","ended_at":null,"scheduled_to_end_at":null,"budget":"10.11","currency":"GBP","manage_url":null,"preview_url":null,"utm_campaign":"1234567890","utm_source":"facebook","utm_medium":"facebook-post","budget_type":"daily","description":null,"marketing_channel":"social","paid":false,"referring_domain":"facebook.com","breadcrumb_id":null,"marketing_activity_id":null,"admin_graphql_api_id":"gid://shopify/MarketingEvent/998730532","marketed_resources":[]}} ``` ## Updates a marketing event Updates a marketing event ### Endpoint /admin/api/#{api_version}/marketing_events/{marketing_event_id}.json (PUT) ### Parameters * api_version (required): * marketing_event_id (required): ### Responses #### 200 Updates a marketing event Examples: ##### Update a marketing event. Can modify only timestamps, remote_id, and budget/currency. Request: ``` PUT /admin/api/unstable/marketing_events/998730532.json {"marketing_event":{"id":998730532,"remote_id":"1000:2000","started_at":"2025-02-02T00:00 +00:00","ended_at":"2025-02-03T00:00 +00:00","scheduled_to_end_at":"2025-02-04T00:00 +00:00","budget":"11.1","budget_type":"daily","currency":"CAD","utm_campaign":"other","utm_source":"other","utm_medium":"other","event_type":"ad","referring_domain":"instagram.com"}} ``` Response: ``` HTTP/1.1 200 OK {"marketing_event":{"started_at":"2025-02-01T19:00:00-05:00","ended_at":"2025-02-02T19:00:00-05:00","scheduled_to_end_at":"2025-02-03T19:00:00-05:00","remote_id":"1000:2000","currency":"CAD","budget":"11.1","budget_type":"daily","event_type":"post","id":998730532,"manage_url":null,"preview_url":null,"utm_campaign":"1234567890","utm_source":"facebook","utm_medium":"facebook-post","description":null,"marketing_channel":"social","paid":false,"referring_domain":"facebook.com","breadcrumb_id":null,"marketing_activity_id":null,"admin_graphql_api_id":"gid://shopify/MarketingEvent/998730532","marketed_resources":[]}} ``` ## Deletes a marketing event Deletes a marketing event ### Endpoint /admin/api/#{api_version}/marketing_events/{marketing_event_id}.json (DELETE) ### Parameters * api_version (required): * marketing_event_id (required): ### Responses #### 200 Deletes a marketing event Examples: ##### Delete a marketing event Request: ``` DELETE /admin/api/unstable/marketing_events/998730532.json ``` Response: ``` HTTP/1.1 200 OK {} ``` ## Creates marketing engagements on a marketing event

Engagements on marketing events represent customer activity taken on the marketing event before customers reach the shop’s website. Not all types of marketing events will necessarily have engagement, and most types of marketing events will only use a subset of the possible engagement types.


Engagements are aggregated on a daily basis. However, the data can be sent more often than once a day if the information is available. If you create an engagement with the same value for occurred_on as an existing engagement, then the new engagement will overwrite the previous one.

### Endpoint /admin/api/#{api_version}/marketing_events/{marketing_event_id}/engagements.json (POST) ### Parameters * api_version (required): * marketing_event_id (required): * occurred_on (required): The date that these engagements occurred on, in the format “YYYY-MM-DD”. * ad_spend: The total ad spend for the day, if the marketing event is a paid ad with a daily spend. * clicks_count: The total number of clicks on the marketing event for the day. * comments_count: The total number of comments for the day. * favorites_count: The total number of favorites for the day. * impressions_count: The total number of impressions for the day. An impression occurs when the marketing event is served to a customer, either as a email or through a marketing channel. * is_cumulative: Whether the engagements are reported as lifetime values rather than daily totals. * shares_count: The total number of shares for the day. * views_count: The total number of views for the day. A view occurs when a customer reads the marketing event that was served to them, for example, if the customer opens the email or spends time looking at a Facebook post. ### Responses #### 201 Creates marketing engagements on a marketing event Examples: ##### Add engagements to a marketing engagement Request: ``` POST /admin/api/unstable/marketing_events/998730532/engagements.json {"engagements":[{"occurred_on":"2025-01-15","views_count":0,"clicks_count":0,"favorites_count":0,"ad_spend":10.0,"is_cumulative":true},{"occurred_on":"2025-01-16","views_count":100,"clicks_count":50,"is_cumulative":true},{"occurred_on":"2025-01-17","views_count":200,"clicks_count":100,"is_cumulative":true}]} ``` Response: ``` HTTP/1.1 201 Created {"engagements":[{"occurred_on":"2025-01-15","fetched_at":null,"views_count":0,"impressions_count":null,"clicks_count":0,"favorites_count":0,"comments_count":null,"shares_count":null,"ad_spend":"10.0","currency_code":null,"is_cumulative":true,"unsubscribes_count":null,"complaints_count":null,"fails_count":null,"sends_count":null,"unique_views_count":null,"unique_clicks_count":null,"utc_offset":null},{"occurred_on":"2025-01-16","fetched_at":null,"views_count":100,"impressions_count":null,"clicks_count":50,"favorites_count":null,"comments_count":null,"shares_count":null,"ad_spend":null,"currency_code":null,"is_cumulative":true,"unsubscribes_count":null,"complaints_count":null,"fails_count":null,"sends_count":null,"unique_views_count":null,"unique_clicks_count":null,"utc_offset":null},{"occurred_on":"2025-01-17","fetched_at":null,"views_count":200,"impressions_count":null,"clicks_count":100,"favorites_count":null,"comments_count":null,"shares_count":null,"ad_spend":null,"currency_code":null,"is_cumulative":true,"unsubscribes_count":null,"complaints_count":null,"fails_count":null,"sends_count":null,"unique_views_count":null,"unique_clicks_count":null,"utc_offset":null}]} ```