Creating marketing events and engagements

This guide covers creating marketing events and understanding how they interact with your app's marketing efforts. For example, marketing events can be created for email campaigns, affiliate links, advertisements, and other common marketing tactics. The guide also covers creating engagements, which represent customer interactions with your marketing events. Comments, shares, and ad spend are all examples of engagements for an ad campaign.

For a complete list of marketing events properties, see the MarketingEvent resource.

About marketing events

Marketing events are used to market items in a merchant's store such as products, collections, and discounts. Marketing events target multiple users and are intended to drive traffic. 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.

Before you begin

Before you begin, make sure your app has the write_marketing_events access scope.

Create marketing events

Marketing events can be created to track ad campaigns that target a specific time of year. By way of example, a marketing event can be created to track a Facebook ad campaign for Christmas 2018. 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. The following POST request creates a marketing event for tracking Christmas 2018:

POST https://{shop}.myshopify.com/admin/api/2019-04/marketing_events.json

Request Body

{
  "marketing_event": {
    "started_at": "2018-12-15",
    "utm_campaign": "Christmas2018",
    "utm_source": "facebook",
    "utm_medium": "cpc",
    "event_type": "ad",
    "referring_domain": "facebook.com",
    "marketing_channel": "social",
    "paid": true
  }
}

Response

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 2018 ad campaign would use the following URL convention:

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

Create engagements

After you've created marketing events, you can create engagements to track user interactions. For example, engagements for ad campaigns include clicks, shares and comments. Creating engagements is optional, and not all marketing events include engagements. Engagements are recommended if you want merchants to have more insight into how potential customers interact with your marketing events.

To create an engagement, send a POST request including the id of the marketing event you created before:

POST https://{shop}.myshopify.com/admin/api/2019-04/marketing_events/{marketing_event_id}/engagements.json

Request Body

{
  "engagements": [
    {
      "occurred_on": "2018-12-15",
      "views_count": 0,
      "clicks_count": 0,
      "favorites_count": 0,
      "ad_spend": 10.0,
      "is_cumulative": true
    },
    {
      "occurred_on": "2018-12-16",
      "views_count": 100,
      "clicks_count": 50,
      "is_cumulative": true
    },
    {
      "occurred_on": "2018-12-17",
      "views_count": 200,
      "clicks_count": 100,
      "is_cumulative": true
    }
  ]
}

Response

For a complete list of engagements properties, see the MarketingEvent resource.

Sign up for a Partner account to get started.

Sign up