Realtime Logs

Based on the real-time logs sent to DIS, RES performs computing tasks and processes and updates user-related data. The following describes logs sent to DIS.

Real-Time Behavior Log

Functions of real-time behavior logs:

  • Update users' interest tags.
  • Record history of behavior types selected.
  • Update users' contextual information.
  • Retrieve candidate sets.
Table 1 Parameters

Parameter

Type

Description

Mandatory

userId

String

User ID

Yes

objectType

String

Object type of a behavior. Item is an object of a behavior.

Yes

actionObject

String

ID of an object that users have performed operations on. The value is the item ID.

Yes

actionType

String

Behavior types:

  • View
  • Click
  • Collect
  • Uncollect
  • Search_click
  • Comment
  • Share
  • Like
  • Dislike
  • Grade
  • Consume
  • Use

Yes

actionMeasure

String

Measurement of a behavior, such as the amount paid, score rated, and how many times it happened (integer).

Default value:

  • For the behaviors Rate or Use, the value is determined by users as needed. For example, the value 1.5 indicates two minutes spent watching videos, and the value 1.8 indicates 5 minutes spent.
  • The default value of other behaviors is 1.0.

Yes

actionContent

String

For the behavior Make comments, the content of comments needs to be recorded.

For the behavior Click an item in search results, the search keywords need to be recorded.

No

actionDateTime

String

Time when a behavior occurs, in seconds and complied with Coordinated Universal Time (UTC).

No

actionLocation

String

Location of a behavior, including the latitude and longitude. The format is [latitude, longitude].

No

context

JSON

Contextual information about an action. The content is a JSON string and can function as an extended field in User Operation Behavior Table. For example, current device ID and IP address of a user are types of contextual information.

No

subSite

String

ID of the location where a behavior occurs, for example, a homepage where you can click recommendation items to enter item details page.

No

traceId

String

Unique ID used to trace each recommendation item. The ID is used in effect evaluation.

No

flowId

String

ID of a flow, which is used to evaluate effect of an online flow. The flow ID is returned by the RES API to users. You need to write the flow ID to the user behavior logs.

No

Real-Time Behavior Log Example

{
	"userId": "user1",
	"objectType": "item",
	"actionObject": "item1",
	"actionType": "collect",
	"actionMeasure": "1.0",
	"actionDateTime": "1512689700"
}

Real-time User Log

Real-time user logs can be used to write real-time data into user profiles in the streaming mode.

Table 2 Parameters

Parameter

Type

Description

Mandatory

userId

String

Unique user ID

Yes

BASICINFO

JSON

Basic user attribute value, which must be a numeric string, a character string, or an array of character strings.

No

TAGS

JSON

Users' interest tags, which must be a Map string.

Different types of tags (such as manual tags and keyword tags) can be written into profiles.

The tag system must be the same as that of item tags. If there are no historical interest tags, this field does not need to be written. RES can perform computing tasks and be updated by tags that match specified behaviors.

NOTE:

The written field TAGS overwrites the weights of interest tags that have already been calculated in the original program.

No

CONTEXT

JSON

Users' contextual information, which must be a numeric string, a character string, or an array of character strings.

No

Real-time User Log Example

{
    "userId":"user123",
    "BASICINFO":{
        "age":15,
        "gender":"male",
        "salary":31693.84172,
        "hobbies":[
"Sports",
"Art",
"Music",
"Fighting",
"Calligraphy"
        ]
    },
    "TAGS":{
        "artificialLabel":{
            "tag1":0.84,
            "tag2":0.22,
            "tag3":0.88
        },
        "keywordLabel":{
            "tag4":0.22,
            "tag5":0.99
        }
    },
    "CONTEXT":{
        "provinceId":"3853",
        "cityId":"3868",
        "districtId":"3873"
    }
}

Real-time Item Log

Real-time user logs help you write real-time data into item profiles in the streaming mode.

Table 3 Parameters

Parameter

Type

Description

Mandatory

itemId

String

Unique item ID

Yes

BASICINFO

JSON

Basic item attribute value, which must be a numeric string, a character string, or an array of character strings.

No

TAGS

JSON

Item tag, which must be a Map string.

Different types of tags (such as manual tags and keyword tags) can be written into profiles.

NOTE:

If this field is left blank, RES cannot calculate the users' interest tags based on user behaviors.

No

Table 4 Example table

itemId

BASICINFO

TAGS

item123

weight

brand

price

artificialLabel

keywordLabel

12

"male"

333

{"tag1":0.84,"tag2":0.22,"tag3":0.88}

{"tag4":0.22,"tag5":0.99}

Real-Time Item Log Example

{
    "itemId":"item123",
    "BASICINFO":{
        "weight":12,
        "brand":"male",
        "price":333
    },
    "TAGS":{
        "artificialLabel":{
            "tag1":0.84,
            "tag2":0.22,
            "tag3":0.88
        },
        "keywordLabel":{
            "tag4":0.22,
            "tag5":0.99
        }
    }
}