Link up

Before you start

You must register the Web > Root Domain in the Data Source item on the Service Management/Service Information page of the DFINERY console.

ex) https://console.dfinery.io -> dfinery.io registration

SDK Supported Browsers

Supported browsers are as follows:

Chrome, Safari, Samsung Internet, Edge, Whale, Firefox, Opera

Installing the SDK

Install and initialize the SDK by adding the code below.

// SDK Install the latest version
!function(_,e){if(void 0!==_&&!_.Dfinery){var d={queue:[]},t=e.createElement("script");t.type="text/javascript",t.async=!0,t.src="//static.dfinery.io/web-sdk/latest/dfn-web-sdk.min.js",t.onload=function(){_.Dfinery.runQueuedFunctions&&_.Dfinery.runQueuedFunctions()};var n=e.getElementsByTagName("script")[0];n.parentNode.insertBefore(t,n);["init","onInitialized","logEvent","setUserProfile","setUserProfiles","setIdentity","setIdentities","resetIdentity"].forEach((function(_){var e=_.split("."),t=e.pop();e.reduce((function(_,e){return _[e]=_[e]||{}}),d)[t]=function(){d.queue.push([_,arguments])}}));const i={LOGIN:"df_login",LOGOUT:"df_logout",SIGN_UP:"df_sign_up",PURCHASE:"df_purchase",REFUND:"df_refund",VIEW_HOME:"df_view_home",VIEW_PRODUCT_DETAILS:"df_view_product_details",ADD_TO_CART:"df_add_to_cart",ADD_TO_WISHLIST:"df_add_to_wishlist",VIEW_SEARCH_RESULT:"df_view_search_result",SHARE_PRODUCT:"df_share_product",VIEW_LIST:"df_view_list",VIEW_CART:"df_view_cart",REMOVE_CART:"df_remove_cart",ADD_PAYMENT_INFO:"df_add_payment_info"},E={ITEMS:"df_items",ITEM_ID:"df_item_id",ITEM_NAME:"df_item_name",ITEM_PRICE:"df_price",ITEM_QUANTITY:"df_quantity",ITEM_DISCOUNT:"df_discount",ITEM_CATEGORY1:"df_category1",ITEM_CATEGORY2:"df_category2",ITEM_CATEGORY3:"df_category3",ITEM_CATEGORY4:"df_category4",ITEM_CATEGORY5:"df_category5",DISCOUNT:"df_discount",TOTAL_REFUND_AMOUNT:"df_total_refund_amount",ORDER_ID:"df_order_id",DELIVERY_CHARGE:"df_delivery_charge",PAYMENT_METHOD:"df_payment_method",TOTAL_PURCHASE_AMOUNT:"df_total_purchase_amount",SHARING_CHANNEL:"df_sharing_channel",SIGN_CHANNEL:"df_sign_channel",KEYWORD:"df_keyword"},f={MALE:"Male",FEMALE:"Female",NON_BINARY:"NonBinary",OTHER:"Other"},r={EXTERNAL_ID:"external_id",EMAIL:"email",PHONE_NO:"phone_no",KAKAO_USER_ID:"kakao_user_id",LINE_USER_ID:"line_user_id",UNIFIED_ID:"unified_id"},o={BIRTH:"df_birth",GENDER:"df_gender",NAME:"df_name",MEMBERSHIP:"df_membership",PUSH_OPTIN:"df_push_optin",PUSH_ADS_OPTIN:"df_push_ads_optin",PUSH_NIGHT_ADS_OPTIN:"df_push_night_ads_optin",SMS_ADS_OPTIN:"df_sms_ads_optin",KAKAO_ADS_OPTIN:"df_kakao_ads_optin"},a={LOG_ENABLE:"logEnable",LOG_LEVEL:"logLevel",SHARE_SUBDOMAIN_COOKIE:"shareSubdomainCookie"},I={DISABLE:0,ERROR:1,WARN:2,INFO:3};_.DFEvent=i,_.DFEventProperty=E,_.DFGender=f,_.DFIdentity=r,_.DFUserProfile=o,_.DFConfig=a,_.DFLogLevel=I,_.Dfinery=d}}(window,document);

SDK Initialization

init("SERVICE_KEY");

The parameters mean:

  • SERVICE_KEY: Service key issued from DFINERY console

SDK Setup

init("SERVICE_KEY", initOptions);

The parameters mean:

  • initOptions: SDK Settings Dictionary

SDK setting values

Name
Type
Default
Explanation
Essential

shareSubdomainCookie

boolean

true

Whether to use cookies shared with subdomains

X

logEnable

boolean

true

Whether to enable logging

X

logLevel

DFLogLevel

DFLogLevel.Error

X

Example of use

const initOptions = {}
// INFO When set to, you can view detailed logs.  Recommended for testing.
initOptions[DFConfig.LOG_LEVEL] = window.DFLogLevel.Info 

Dfinery.init('Your ServiceId', initOptions);

SDK Settings Constants

Constant
Value
Explanation

DFConfig.LOG_ENABLE

logEnable

Whether to enable logging

DFConfig.LOG_LEVEL

logLevel

Log level

DFConfig.SHARE_SUBDOMAIN_COOKIE

shareSubdomainCookie

Whether to use cookies shared with subdomains

Log level

Constant
Value
Explanation

DFLogLevel.ERROR

1

Show error log only

DFLogLevel.WARN

2

Show Warn, Error log

DFLogLevel.INFO

3

Display Error, Warn, Info logs

Complete

SDK installation and initialization is complete.

To check if the SDK is installed properly, enter the window. DFINERY in the developer mode console window of the browser to check if the object has been created. If it is not undefined, it is normal.

Last updated