Event
How to record user events using the DFINERY SDK. SDK integration must be done first.
Before you start
Before linking events, you need to register events in the DFINERY console. To register events, go to the console's Additional Settings > Data Linking > Event Management > Event List page and click the Create Event button to create standard and custom events.
Events are not logged if an unregistered event, an event property, an event property of the wrong type, or a registered event property is missing.
Event Log
logEvent
Log user events using methods. Standard events provide constants.
logEvent(eventName);
logEvent(eventName, properties);
Each parameter means:
eventName
: Event Nameproperties
: Event properties
Required values vary for each standard event. Please check and use.
Event log example
// When recording only events ex) When using constants
Dfinery.logEvent(DFEvent.LOGIN);
// Alternatively, you can enter the event property name directly.
Dfinery.logEvent("df_login");
// When recording with event properties ex) Sign up
const properties = {};
properties[DFEventProperty.SIGN_CHANNEL] = "Kakao";
Dfinery.logEvent(DFEvent.SIGN_UP, properties);
Standard Events & Product Attributes
Standard events and standard event properties, product properties are as follows. They can also be used as event names.
Standard Events
Standard event names are provided as predefined static constants:
DFEvent.LOGIN
df_login
Log in
DFEvent.LOGOUT
df_logout
Log out
DFEvent.SIGN_UP
df_sign_up
Join the membership
DFEvent.PURCHASE
df_purchase
Purchase
DFEvent.VIEW_HOME
df_view_home
View Home Screen
DFEvent.VIEW_PRODUCT_DETAILS
df_view_product_details
View product details
DFEvent.ADD_TO_CART
df_add_to_cart
Put in a shopping cart
DFEvent.ADD_TO_WISHLIST
df_add_to_wishlist
Add to Wishlist
DFEvent.REFUND
df_refund
Cancel order
DFEvent.VIEW_SEARCH_RESULT
df_view_search_result
Search for products
DFEvent.SHARE_PRODUCT
df_share_product
Share this product
DFEvent.VIEW_LIST
df_view_list
View product list
DFEvent.VIEW_CART
df_view_cart
View Cart
DFEvent.ADD_PAYMENT_INFO
df_add_payment_info
Enter purchase information
DFEvent.REMOVE_CART
df_remove_cart
Delete Cart
Standard event properties
For property names of standard events, event property names are provided as predefined static constants as follows:
DFEventProperty.ITEMS
df_items
Goods
DFEventProperty.TOTAL_REFUND_AMOUNT
df_total_refund_amount
Total refund (cancellation) amount
DFEventProperty.ORDER_ID
df_order_id
Order Number (ID)
DFEventProperty.DELIVERY_CHARGE
df_delivery_charge
Shipping Fee
DFEventProperty.PAYMENT_METHOD
df_payment_method
Payment Method
DFEventProperty.TOTAL_PURCHASE_AMOUNT
df_total_purchase_amount
Order Total
DFEventProperty.SHARING_CHANNEL
df_sharing_channel
Product sharing channel
DFEventProperty.SIGN_CHANNEL
df_sign_channel
Product Discount Price
DFEventProperty.KEYWORD
df_keyword
Search Keywords
Product Attributes
Information about predefined property values for products loaded as an array in DFEventProperty.ITEMS. ITEM_ID, ITEM_NAME, ITEM_PRICE, ITEM_QUANTITY, ITEM_DISCOUNT are required values and must be included.
DFEventProperty.ITEM_ID
df_item_id
String
Product Number (ID)
✅
DFEventProperty.ITEM_NAME
df_item_name
String
Product Name
✅
DFEventProperty.ITEM_PRICE
df_price
Number
Product unit price
✅
DFEventProperty.ITEM_QUANTITY
df_quantity
Number
Product Quantity
✅
DFEventProperty.ITEM_DISCOUNT
df_discount
Number
Product Discount Price
✅
DFEventProperty.ITEM_CATEGORY1
df_category1
String
Product Category 1
DFEventProperty.ITEM_CATEGORY2
df_category2
String
Product Category 2
DFEventProperty.ITEM_CATEGORY3
df_category3
String
Product Category 3
DFEventProperty.ITEM_CATEGORY4
df_category4
String
Product Category 4
DFEventProperty.ITEM_CATEGORY5
df_category5
String
Product Category 5
Example of using standard events
log in
This is an event that indicates the user's action of logging in. If you set the user's Identity before calling the login event, you can measure it as the Login event for that user. The logEvent function must be called after executing the setIdentity function within the async function.
async function DfineryLogin() {
// Setting user identification information
await Dfinery.setIdentity(DFIdentity.EXTERNAL_ID, "TestUserId");
// login event
Dfinery.logEvent(DFEvent.LOGIN);
}
Dfinery.setIdentity
If you execute Login without waiting for the API, it may not be measured as a Login event for a user who has set Identity, so it must be called after Identity has been set using await or promise.then function.
log out
This event indicates that a user is logging out.
Dfinery.logEvent(DFEvent.LOGOUT);
Join the membership
This event indicates the action taken by a user to sign up as a member.
const properties = {};
properties[DFEventProperty.SIGN_CHANNEL] = "Kakao";
Dfinery.logEvent(DFEvent.SIGN_UP, properties);
Standard event properties
DFEventProperty.SIGN_CHANNEL
String
Membership Channel
✅
Purchase
An event that represents a user's action of purchasing a product or service.
const item = {};
item[DFEventProperty.ITEM_ID] = "Product number";
item[DFEventProperty.ITEM_NAME] = "Product name";
item[DFEventProperty.ITEM_PRICE] = 5000;
item[DFEventProperty.ITEM_DISCOUNT] = 500;
item[DFEventProperty.ITEM_QUANTITY] = 6;
item[DFEventProperty.ITEM_CATEGORY1] = "food";
item[DFEventProperty.ITEM_CATEGORY2] = "snack";
const itemList = [];
itemList.push(item);
const properties = {};
properties[DFEventProperty.ITEMS] = itemList;
properties[DFEventProperty.PAYMENT_METHOD] = "BankTransfer";
properties[DFEventProperty.ORDER_ID] = "Order-123";
properties[DFEventProperty.TOTAL_PURCHASE_AMOUNT] = 30000;
properties[DFEventProperty.DELIVERY_CHARGE] = 2500;
properties[DFEventProperty.DISCOUNT] = 3000;
Dfinery.logEvent(DFEvent.PURCHASE, properties);
Standard event properties
DFEventProperty.ORDER_ID
String
Order Number (ID)
✅
DFEventProperty.PAYMENT_METHOD
String
Payment Method
✅
DFEventProperty.TOTAL_PURCHASE_AMOUNT
NUMBER
Order Total
✅
DFEventProperty.DELIVERY_CHARGE
NUMBER
Shipping Fee
✅
DFEventProperty.DISCOUNT
NUMBER
Product discount price
✅
View Home Screen
This event indicates that the user is viewing the app's home screen.
const properties = {};
properties["key"] = "value"; //Custom property value (Optional)
Dfinery.logEvent(DFEvent.VIEW_HOME, properties);
View product details
This event represents an action taken by a user to view detailed information about a specific product.
const item = {};
item[DFEventProperty.ITEM_ID] = "Product number";
item[DFEventProperty.ITEM_NAME] = "Product name";
item[DFEventProperty.ITEM_PRICE] = 5000;
item[DFEventProperty.ITEM_DISCOUNT] = 500;
item[DFEventProperty.ITEM_QUANTITY] = 5;
item[DFEventProperty.ITEM_CATEGORY1] = "food";
item[DFEventProperty.ITEM_CATEGORY2] = "snack";
const itemList = [];
itemList.push(item);
const properties = {};
properties[DFEventProperty.ITEMS] = itemList;
Dfinery.logEvent(DFEvent.VIEW_PRODUCT_DETAILS, properties);
Put in a shopping cart
This event represents the action of a user adding a product to the shopping cart.
const item = {};
item[DFEventProperty.ITEM_ID] = "Product number";
item[DFEventProperty.ITEM_NAME] = "Product name";
item[DFEventProperty.ITEM_PRICE] = 5000;
item[DFEventProperty.ITEM_DISCOUNT] = 500;
item[DFEventProperty.ITEM_QUANTITY] = 5;
item[DFEventProperty.ITEM_CATEGORY1] = "food";
item[DFEventProperty.ITEM_CATEGORY2] = "snack";
const itemList = [];
itemList.push(item);
const properties = {};
properties[DFEventProperty.ITEMS] = itemList;
Dfinery.logEvent(DFEvent.ADD_TO_CART, properties);
Standard event properties
Add to Wishlist
This event indicates that a user has added a product to their interest list.
const item = {};
item[DFEventProperty.ITEM_ID] = "Product number";
item[DFEventProperty.ITEM_NAME] = "Product name";
item[DFEventProperty.ITEM_PRICE] = 5000;
item[DFEventProperty.ITEM_DISCOUNT] = 500;
item[DFEventProperty.ITEM_QUANTITY] = 5;
item[DFEventProperty.ITEM_CATEGORY1] = "food";
item[DFEventProperty.ITEM_CATEGORY2] = "snack";
const itemList = [];
itemList.push(item);
const properties = {};
properties[DFEventProperty.ITEMS] = itemList;
Dfinery.logEvent(DFEvent.ADD_TO_WISHLIST, properties);
Standard event properties
Cancel Order
This event represents the action of canceling and refunding an order purchased by a user.
const item = {};
item[DFEventProperty.ITEM_ID] = "Product number";
item[DFEventProperty.ITEM_NAME] = "Product name";
item[DFEventProperty.ITEM_PRICE] = 5000;
item[DFEventProperty.ITEM_DISCOUNT] = 500;
item[DFEventProperty.ITEM_QUANTITY] = 5;
item[DFEventProperty.ITEM_CATEGORY1] = "food";
item[DFEventProperty.ITEM_CATEGORY2] = "snack";
const itemList = [];
itemList.push(item);
const properties = {};
properties[DFEventProperty.ITEMS] = itemList;
Dfinery.logEvent(DFEvent.REFUND, properties);
Standard event properties
DFEventProperty.TOTAL_REFUND_AMOUNT
NUMBER
Total refund amount
✅
Search for products
This event represents the action of a user searching for a product and checking the results.
const item = {};
item[DFEventProperty.ITEM_ID] = "Product number";
item[DFEventProperty.ITEM_NAME] = "Product name";
item[DFEventProperty.ITEM_PRICE] = 16000;
item[DFEventProperty.ITEM_DISCOUNT] = 700;
item[DFEventProperty.ITEM_QUANTITY] = 10;
item[DFEventProperty.ITEM_CATEGORY1] = "food";
item[DFEventProperty.ITEM_CATEGORY2] = "snack";
const itemList = [];
itemList.push(item);
const properties = {};
properties[DFEventProperty.ITEMS] = itemList;
properties[DFEventProperty.KEYWORD] = "satobap";
Dfinery.logEvent(DFEvent.VIEW_SEARCH_RESULT, properties);
Standard event properties
DFEventProperty.KEYWORD
String
Search Keywords
✅
Share this product
This event represents a user's action of sharing a product.
const item = {};
item[DFEventProperty.ITEM_ID] = "Product number";
item[DFEventProperty.ITEM_NAME] = "Product name";
item[DFEventProperty.ITEM_PRICE] = 5000;
item[DFEventProperty.ITEM_DISCOUNT] = 500;
item[DFEventProperty.ITEM_QUANTITY] = 5;
item[DFEventProperty.ITEM_CATEGORY1] = "food";
item[DFEventProperty.ITEM_CATEGORY2] = "snack";
const itemList = [];
itemList.push(item);
const properties = {};
properties[DFEventProperty.ITEMS] = itemList;
properties[DFEventProperty.SHARING_CHANNEL] = "Facebook";
Dfinery.logEvent(DFEvent.SHARE_PRODUCT, properties);
Standard event properties
DFEventProperty.SHARING_CHANNEL
String
Product sharing channel
✅
View product list
This event indicates the user's action of viewing a product list.
const item = {};
item[DFEventProperty.ITEM_ID] = "Product number";
item[DFEventProperty.ITEM_NAME] = "Product name";
item[DFEventProperty.ITEM_PRICE] = 5000;
item[DFEventProperty.ITEM_DISCOUNT] = 500;
item[DFEventProperty.ITEM_QUANTITY] = 5;
item[DFEventProperty.ITEM_CATEGORY1] = "food";
item[DFEventProperty.ITEM_CATEGORY2] = "snack";
const itemList = [];
itemList.push(item);
const properties = {};
properties[DFEventProperty.ITEMS] = itemList;
Dfinery.logEvent(DFEvent.VIEW_LIST, properties);
Standard event properties
View Cart
This event indicates the user's action of viewing the shopping cart.
const item = {};
item[DFEventProperty.ITEM_ID] = "Product number";
item[DFEventProperty.ITEM_NAME] = "Product name";
item[DFEventProperty.ITEM_PRICE] = 5000;
item[DFEventProperty.ITEM_DISCOUNT] = 500;
item[DFEventProperty.ITEM_QUANTITY] = 5;
item[DFEventProperty.ITEM_CATEGORY1] = "food";
item[DFEventProperty.ITEM_CATEGORY2] = "snack";
const itemList = [];
itemList.push(item);
//itemList.push(item2); If there are more than 2 items, enter additional items
const properties = {};
properties[DFEventProperty.ITEMS] = itemList;
Dfinery.logEvent(DFEvent.VIEW_CART, properties);
Standard event properties
Enter purchase information
This event represents the action of a user entering purchase information.
const properties = {};
properties["key"] = "value"; //Custom property value (Optional)
Dfinery.logEvent(DFEvent.ADD_PAYMENT_INFO, properties);
Delete Cart
This event indicates that the user has removed a product from their shopping cart.
const item = {};
item[DFEventProperty.ITEM_ID] = "Product number";
item[DFEventProperty.ITEM_NAME] = "Product name";
item[DFEventProperty.ITEM_PRICE] = 5000;
item[DFEventProperty.ITEM_DISCOUNT] = 500;
item[DFEventProperty.ITEM_QUANTITY] = 5;
item[DFEventProperty.ITEM_CATEGORY1] = "food";
item[DFEventProperty.ITEM_CATEGORY2] = "snack";
const itemList = [];
itemList.push(item);
const properties = {};
properties[DFEventProperty.ITEMS] = itemList;
Dfinery.logEvent(DFEvent.REMOVE_CART, properties);
Standard event properties
Custom Events
This is an event that reflects the user's input of an arbitrary event name and properties. You can also use standard events by adding custom properties in the DFINERY Console.
If there is no attribute
Dfinery.logEvent("CUSTOM_EVENT_NAME", null);
If there is an attribute
const properties = {};
properties["CUSTOM_PROPERTY_KEY"] = "CUSTOM_PROPERTY_VALUE"; //Custom property value (Optional)
Dfinery.logEvent("CUSTOM_EVENT_NAME", properties);
Data collected automatically
DFINERY SDK automatically collects the following information:
This value may not be collected depending on the browser environment and type.
Browser
Browser version
OS
Set language
Set Time Zone Offset
Url
Referer
utm parameter
Last updated