Event Management (Old Version 1.0)

Updated at:

This topic describes the Event Management page of the old version in the Automatic Marketing category. Data from the old version event reporting is only available for automatic marketing campaigns initiated by the Behavioral Events component.

Important

Quick Audience provides a new version of the event reporting feature. The new feature allows you to participate in event data ID Mapping and identify the same user in different channels. This allows you to flexibly set marketing plans in automatic marketing. In addition, you can store event data in analysis sources and use it as a common user behavior table. For more information, see Event Reporting API Specifications 3.0.

If you would like to use the new event reporting function, please contact our technical support personnel to help you migrate your existing events to the new version. After the migration, you must purchase a Tablestore instance and configure the related settings by following the Event Reporting Overview procedure. Then, you can use the new API to report events in real time.

Before automatic marketing can use behavioral event data, you need to define events and develop scripts to report the events.

You must define the event and report the event.

You can use the following channels to report custom events:

  • Your party's application: APP, mini program, web page (including H5 page)

  • Third-party system applications

For example, a user clicks a button or purchases a product on your H5 page as an event and reports the event to Quick Audience.

An application or a third-party system can add a script to convert logs tracked by the application into a standard MQ event model and report the event to Quick Audience. For more information, see Report Events.

Custom event

Procedure

  1. Choose Workspace> Configuration Management > Automatic Marketing > Event Management. image

  2. Click New Event in the upper-right corner.

  3. In the dialog box that appears, configure the following parameters: 436

    Item

    Example value

    App type

    The type of the event reporting channel. Valid values:

    • APP

    • Mini Programs

    • WEB: namely web page, including H5 page

    • Third-party Systems

    Channel Name

    Select the channel name from the drop-down list.

    Click Add Channel Name on the drop-down list and Edit Channel Name on the right side of the drop-down list to create and edit a channel name. For more information, see the Add a channel name substep.

    Event code

    Enter or select an event code. The tag developer defines an event code to uniquely identify an event.

    Event Name

    The name of the event.

    Parameters

    When an event is added, additional information that needs to be stored can be stored using event attributes. For example, if the event is "successful purchase of financial products", you can add "financial product type" as the event attribute.

    Click Add Event Property to add a row of event properties.

    Click Remove to remove the corresponding event property.

    Event property data type

    Select Text or Number as the data type of the event property.

    Event Extended Property ID

    The ID of the input event extended property.

    The tracking developer defines the attribute ID to store the subsidiary information of the collection event. For example, if the app collection event is "purchase commodity", the attribute name can be "commodity ID", and the attribute ID can correspond to "item_id".

    Event extension property name

    Enter the event extension property name.

    • Add a channel name: Click Add Channel Name. In the Add Channel Name dialog box, enter the channel name and APP_KEY. The APP_KEY uniquely identifies a channel and is generally the appkey defined on the collection platform. 34253

    • Edit Channel Name: If you click Edit Channel Name, a pop-up window appears, as shown in the following figure.

      • Click Edit to modify the channel name.

      • If no events are found in a channel, click Delete to delete the channel.

      23465

  4. Click OK.

Manage events

The following figure shows the event list. 26

You can perform the following operations on events:

  • Search: You can search by name or event code in the upper-right corner of the page.

  • Filter: In the upper-right corner of the page, you can filter events from specified channels.

  • Edit: Click Edit in the Actions column corresponding to a custom event to edit the event. You can modify the name of an event and the names of extended event attributes, and add event attributes. You cannot modify other parameters or delete event attributes. The procedure is the same as when you create an event.

  • Delete: Click Delete in the Actions column corresponding to a custom event to delete the event that is not used by the automatic marketing task. If an event has been used, it cannot be deleted.

Report an event

The R&D personnel of an application or a third-party system need to write a script to convert the logs collected by the application into a standard MQ event model and report them to Quick Audience. The following figure shows the event and user information reporting links. 37

To report events, you must install the Java SDK provided by Alibaba Cloud and use the behavior event message reporting interface and the user identity reporting API. The following list describes the donut and polar area charts:

Prerequisites

  • Install Cloud Phone SDK for Java

    1. For more information about how to install the core library for Java, see Install Alibaba Cloud SDK for Java.

      Note

      For more information about how to use the SDK, see Java Example.

    2. Install the QuickAudience Java SDK. Open the Aliyun Java SDK QuickAudience Public, download and install the QuickAudience Java SDK.

    3. Add Maven dependencies to the pom.xml file in the project directory. After the dependencies are added, Maven automatically downloads the relevant JAR packages.

      !" -- Introduce the Alibaba Cloud Core package -->
      <dependency>
        <groupId>com.aliyun</groupId>
        <artifactId>aliyun-java-sdk-core</artifactId>
        <version>4.5.2</version>
      </dependency>
      
      <! -- Introduce the QuickAudience SDK-->
      <!-- https://mvnrepository.com/artifact/com.aliyun/aliyun-java-sdk-retailadvqa-public -->
      <dependency>
          <groupId>com.aliyun</groupId>
          <artifactId>aliyun-java-sdk-retailadvqa-public</artifactId>
          <version>3.3.16</version>
      </dependency>
  • Common input parameters of an API

    Parameter

    Description

    Required

    Example

    accessId

    QA instance ID, caller ID

    Yes

    retailadvqa-cn-xxxxxxxxx

    organizationId

    QA Organization ID

    Yes

    56621289-820e-433a-9947-xxxxxxxxx

    • accessId: Enter the ID of your primary Alibaba Cloud account to go to the Order List page. Find the Quick Audience order and click Details in the Actions column. 4356789

    • organizationId: You can obtain the value when you log on to QA by using the developer tool of your browser, as shown in the following figure. image.png

  • OpenAPI Endpoint List

    Regions

    Regions

    Endpoint

    cn-shanghai

    China (Shanghai)

    quicka-public.cn-shanghai.aliyuncs.com

    cn-shenzhen

    China (Shenzhen)

    quicka-public.cn-shenzhen.aliyuncs.com

    cn-zhangjiakou

    China (Zhangjiakou)

    quicka-public.cn-zhangjiakou.aliyuncs.com

Behavior event message reporting API

  • Interface input parameters

    Parameter

    Description

    Parameter Type

    Required

    Examples

    eventMessageModelListStr

    Behavior event message body list

    String

    Yes

    [ { "organizationId": "The ID of the organization. For more information about how to obtain the organization ID, see Common input parameters of the operation.", "workspaceId": "The ID of the workspace, which can be obtained on the Workspace Management page", "customerId": "User ID", "eventSourceCode": "Event Channel Code", "eventCode": "Event code", "eventTime": 1651114368518, "extendAttributes": { "Event Attribute": "Event Attribute Value", "outBizId": "unique business ID, required" }, "customerIdList": [ { "customerId": "xxxxxxxxx", "idMapping": "mobile" }, { "customerId": "xxxxx@alibaba.com", "idMapping": "email" } ], "v": 1 } ]

  • API output parameters

    Value

    Description

    Parameter Type

    Example

    success

    Whether the API call is successful or not

    Boolean

    true

    errorCode

    Error code: API call failure

    String

    ES0110000002

    errorDesc

    Error message: When an API call fails

    String

    Authentication failed!

    traceId

    Request ID: facilitates problem location

    String

    None

  • Access Demo

    import com.alibaba.fastjson.JSONObject;
    import com.aliyuncs.DefaultAcsClient;
    import com.aliyuncs.IAcsClient;
    import com.aliyuncs.exceptions.ClientException;
    import com.aliyuncs.profile.DefaultProfile;
    import com.aliyuncs.retailadvqa_public.model.v20200515.RecieveEventMessageRequest;
    import com.aliyuncs.retailadvqa_public.model.v20200515.RecieveEventMessageResponse;
    import io.swagger.annotations.ApiModelProperty;
    import lombok.Data;
    
    import java.util.Arrays;
    import java.util.HashMap;
    import java.util.Map;
    
    /**
     * Report event messages.
    */
    public class RecieveEventMessage {
        // The AccessKey pair of an Alibaba Cloud account has permissions to call all API operations. We recommend that you use the AccessKey pair of a RAM user to call API operations or perform routine O&M. 
        // We recommend that you do not include your AccessKey pair (AccessKey ID and AccessKey secret) in your project code. Otherwise, the AccessKey pair may be leaked and the security of all resources within your account may be compromised. 
        // In this example, the AccessKey pair and AccessKeySecret are stored in environment variables. 
        // The method for saving environment variables is as follows:
        // Configure the Linux and macOS systems.
        // Run the following command:
        // export SCA_AK_ENV=<access_key_id>
        // export SCA_SK_ENV=<access_key_secret>
        // Replace <access_key_id> with the AccessKey ID and <access_key_secret> with the AccessKey secret. 
    
        static String accessKey = System.getenv("SCA_AK_ENV");
        static String accessSecret = System.getenv("SCA_SK_ENV");
        static String regionId = "cn-shanghai";
        static String product = "retailadvqa-public";
        static String endpointUrl = "quicka-public.cn-shanghai.aliyuncs.com";
    
        static IAcsClient client = null;
        static {
            DefaultProfile profile =
                    DefaultProfile.getProfile(
                            regionId, // The region ID.
                            accessKey, // The AccessKey ID of the RAM user.
                            accessSecret // The AccessKeySecret of the RAM user.
                    );
            try {
                DefaultProfile.addEndpoint(
                        regionId,
                        product,
                        endpointUrl
                );
            } catch (Exception e) { }
            client= new DefaultAcsClient(profile);
        }
    
        public static void recieveEventMessage() throws ClientException {
            RecieveEventMessageRequest eventMessageRequest = new RecieveEventMessageRequest();
            eventMessageRequest.setAccessId("retailadvqa-xx-xxxxxxxxx");
            eventMessageRequest.setOrganizationId("56621289-820e-433a-9947-xxxxxxxxx");
    
    
            EventMessageModel messageModel = new EventMessageModel();
            messageModel.setOrganizationId(eventMessageRequest.getOrganizationId());
            messageModel.setCustomerId("customer001");
            messageModel.setEventSourceCode("eventsource001");
            messageModel.setEventCode("event001");
            messageModel.setEventTime(System.currentTimeMillis());
            Map<String, String> extendAttributes = new HashMap<>();
            extendAttributes.put("key1", "value1");
            extendAttributes.put("key2", "123456");
            messageModel.setExtendAttributes(extendAttributes);
    
            // The batch reporting operation. The batch reporting operation is 100. 
            eventMessageRequest.setEventMessageModelListStr(JSONObject.toJSONString(Arrays.asList(messageModel)));
            System.out.println(JSONObject.toJSONString(Arrays.asList(messageModel)));
    
            RecieveEventMessageResponse recieveEventMessageResponse = client.getAcsResponse(eventMessageRequest);
            System.out.println("result = " + JSONObject.toJSONString(recieveEventMessageResponse));
        }
    
        public static void main(String... args) throws ClientException {
            recieveEventMessage();
        }
    
        @Data
        public static class EventMessageModel {
    
            @ ApiModelProperty("Organization Id")
            String organizationId;
    
            @ ApiModelProperty(required = true, value = "User /Fan Id")
            String customerId;
    
            @ ApiModelProperty("app_key. If there is no app_key in the event message, the automatic marketing task calculation will not be limited by the channel ")
            String eventSourceCode;
    
            @ ApiModelProperty(required = true, value = "event code")
            String eventCode;
    
            @ ApiModelProperty(required = true, value = "The time when the event actually occurred")
            Long eventTime;
    
            @ ApiModelProperty("Event extension property ID and corresponding value")
            Map<String, String> extendAttributes = new HashMap<>();
    
            @ ApiModelProperty("Event message model version number")
            Integer v = 1;
        }
    }

User identity reporting API

  • API input parameters

    Parameter

    Description

    Parameter Type

    Required

    Examples

    customerMessageModelListStr

    User identity message body list

    String

    Yes

    [{"customerId":"customer001","customerIdList":[{"customerId":"1388888****","idMapping":"mobile"}],"organizationId":"56621289-820e-433a-9947-xxxxxxxxx","v":1}]

  • Output parameters

    Value

    Description

    Parameter Type

    Example

    success

    Whether the API call is successful or not

    Boolean

    true

    errorCode

    Error code: API call failure

    String

    ES0110000002

    errorDesc

    Error message: When an API call fails

    String

    Authentication failed!

    traceId

    Request ID: facilitates problem location

    String

    None

  • Access Demo

    import com.alibaba.fastjson.JSONObject;
    import com.aliyuncs.DefaultAcsClient;
    import com.aliyuncs.IAcsClient;
    import com.aliyuncs.exceptions.ClientException;
    import com.aliyuncs.profile.DefaultProfile;
    import com.aliyuncs.retailadvqa_public.model.v20200515.RecieveUserMessageRequest;
    import com.aliyuncs.retailadvqa_public.model.v20200515.RecieveUserMessageResponse;
    import io.swagger.annotations.ApiModelProperty;
    import lombok.Data;
    
    import java.util.Arrays;
    import java.util.List;
    
    /**
     * Report the user identity.
     */
    public class RecieveCustomerMessage {
        // The AccessKey pair of an Alibaba Cloud account has permissions to call all API operations. We recommend that you use the AccessKey pair of a RAM user to call API operations or perform routine O&M. 
        // We recommend that you do not include your AccessKey pair (AccessKey ID and AccessKey secret) in your project code. Otherwise, the AccessKey pair may be leaked and the security of all resources within your account may be compromised. 
        // In this example, the AccessKey pair and AccessKeySecret are stored in environment variables. 
        // The method for saving environment variables is as follows:
        // Configure the Linux and macOS systems.
        // Run the following command:
        // export SCA_AK_ENV=<access_key_id>
        // export SCA_SK_ENV=<access_key_secret>
        // Replace <access_key_id> with the AccessKey ID and <access_key_secret> with the AccessKey secret. 
    
        static String accessKey = System.getenv("SCA_AK_ENV");
        static String accessSecret = System.getenv("SCA_SK_ENV");
        static String regionId = "cn-shanghai";
        static String product = "retailadvqa-public";
        static String endpointUrl = "quicka-public.cn-shanghai.aliyuncs.com";
    
        static IAcsClient client = null;
        static {
            DefaultProfile profile =
                    DefaultProfile.getProfile(
                            regionId, // The region ID.
                            accessKey, // The AccessKey ID of the RAM user.
                            accessSecret // The AccessKeySecret of the RAM user.
                    );
            try {
                DefaultProfile.addEndpoint(
                        regionId,
                        product,
                        endpointUrl
                );
            } catch (Exception e) { }
            client= new DefaultAcsClient(profile);
        }
    
        public static void recieveCustomerMessage() throws ClientException {
            RecieveUserMessageRequest recieveUserMessageRequest = new RecieveUserMessageRequest();
            recieveUserMessageRequest.setAccessId("retailadvqa-xx-xxxxxxxxx");
            recieveUserMessageRequest.setOrganizationId("56621289-820e-433a-9947-xxxxxxxxx");
            CustomerMessageModel customerMessageModel = new CustomerMessageModel();
            customerMessageModel.setOrganizationId(recieveUserMessageRequest.getOrganizationId());
            customerMessageModel.setCustomerId("customer001");
            CustomerIdModel idModel = new CustomerIdModel();
            idModel.setCustomerId("13888888888");
            idModel.setIdMapping("mobile");
            customerMessageModel.setCustomerIdList(Arrays.asList(idModel));
    
            // The number of messages to be reported is 100. 
            recieveUserMessageRequest.setCustomerMessageModelListStr(JSONObject.toJSONString(Arrays.asList(customerMessageModel)));
            System.out.println(JSONObject.toJSONString(Arrays.asList(customerMessageModel)));
            RecieveUserMessageResponse recieveUserMessageResponse = client.getAcsResponse(recieveUserMessageRequest);
            System.out.println("result = " + JSONObject.toJSONString(recieveUserMessageResponse));
        }
    
        public static void main(String... args) throws ClientException {
            recieveCustomerMessage();
        }
    
        @Data
        public static class CustomerMessageModel {
    
            @ ApiModelProperty("Organization Id")
            String organizationId;
    
            @ ApiModelProperty(required = true, value = "User /Fan Id")
            String customerId;
    
            @ ApiModelProperty(required = true, value = "User ID information: such as idfa, imei, mobile")
            List<CustomerIdModel> customerIdList;
    
    
            @ ApiModelProperty("User identity message model version number")
            Integer v = 1;
        }
    
        @Data
        public static class CustomerIdModel {
    
            @ ApiModelProperty(required = true, value = "User /Fan Id")
            String customerId;
    
            /**
             Currently, the following user ID types are supported:
             1)oneid
             2)email: E-mail
             3)mobile: mobile phone number
             4)taobao_id: Taobao ID
             5)taobao_nick: Taobao nickname
             6)imei: mobile phone IMEI
             7)idfa: mobile IDFA
             8)mac_org:MAC address
             9)weibo_id_org: Weibo ID
             10)alipay_id: the ID of Alipay.
             11)open_id: WeChat OpenID
             12) union_id: WeChat UnionID
             */
            @ ApiModelProperty(required = true, value = "User Id type")
            String idMapping;
        }
    }