Track Commerce, Content, Lifecycle and Custom Events

Overview

Branch SDK에서는 기본적으로 클릭, 오픈, 설치, 재설치 및 임프레션을 자동으로 추적합니다(기본 제공).

마찬가지로 Branch Web SDK에서는 페이지 뷰, 웹 세션 시작, 클릭 및 임프레션을 자동으로 추적합니다(기본 제공).

또한 Branch는 이벤트를 의미에 따라 여러 카테고리로 분류하여 추적 및 저장하고 있습니다. 예를 들어, 고객 구매와 관련된 모든 이벤트는 "commerce event" 카테고리로 분류되고 앱내 콘텐츠와 상호 작용하는 유저 행위와 관련된 모든 이벤트는 "content_event"카테고리로 분류됩니다.

다음은 가장 보편적으로 사용되는 이벤트를 Branch SDK를 통해 추적하는 방법을 안내하고 있습니다.

Acceptance

Branch에서 추적한 이벤트를 Criteo와 같은 애드 네트워크에 포스트백으로 전송하여 실적확인, 광고 최적화, 리타게팅에 활용할 수 있습니다. 예를 들어 Branch를 통해 추적한 PURCHASE이벤트를 Criteo의 trackTransaction에 매핑하여 전송할 수 있습니다.

이러한 이벤트에는 분석 기능도 있음으로 새로운 사용자 중심 어트리뷰션을 사용하여 해당 이벤트의 성과를 이해할 수 있습니다.

한계

현재로서는 추적한 이벤트는 아래와 같은 한계가 있습니다..

  • Referrals 시스템에 사용할 수 없습니다.
  • 이벤트의 커스텀 데이터 및 하위 파라미터를 LiveviewExports를 제외한 기타 대시보드 영역에서 확인할 수 없습니다. (이벤트 로그를 추출하여 확인할 것을 권장)

사용 가능한 이벤트

Event Name iOS Android Web/API
Add To Cart BranchStandardEventAddToCart BRANCH_STANDARD_EVENT.ADD_TO_CART ADD_TO_CART
Add To Wishlist BranchStandardEventAddToWishlist BRANCH_STANDARD_EVENT.ADD_TO_WISHLIST ADD_TO_WISHLIST
View Cart BranchStandardEventViewCart BRANCH_STANDARD_EVENT.VIEW_CART VIEW_CART
Initiate Purchase BranchStandardEventInitiatePurchase BRANCH_STANDARD_EVENT.INITIATE_PURCHASE INITIATE_PURCHASE
Add Payment Info BranchStandardEventAddPaymentInfo BRANCH_STANDARD_EVENT.ADD_PAYMENT_INFO ADD_PAYMENT_INFO
Click Ad BranchStandardEventClickAd BRANCH_STANDARD_EVENT.CLICK_AD CLICK_AD
Click Ad BranchStandardEventClickAd BRANCH_STANDARD_EVENT.CLICK_AD CLICK_AD
Purchase BranchStandardEventPurchase BRANCH_STANDARD_EVENT.PURCHASE PURCHASE
Reserve BranchStandardEventReserve BRANCH_STANDARD_EVENT.RESERVE RESERVE
Spend Credits BranchStandardEventSpendCredits BRANCH_STANDARD_EVENT.SPEND_CREDITS SPEND_CREDITS
View Ad BranchStandardEventViewAd BRANCH_STANDARD_EVENT.VIEW_AD VIEW_AD
Event Name iOS Android Web/API
Search BranchStandardEventSearch BRANCH_STANDARD_EVENT.SEARCH SEARCH
View Item BranchStandardEventViewItem BRANCH_STANDARD_EVENT.VIEW_ITEM VIEW_ITEM
View Items BranchStandardEventViewItems BRANCH_STANDARD_EVENT.VIEW_ITEMS VIEW_ITEMS
Rate BranchStandardEventRate BRANCH_STANDARD_EVENT.RATE RATE
Share BranchStandardEventShare BRANCH_STANDARD_EVENT.SHARE SHARE
Initiate Stream BranchStandardEventInitiateStream BRANCH_STANDARD_EVENT.INITIATE_STREAM INITIATE_STREAM
Complete Stream BranchStandardEventCompleteStream BRANCH_STANDARD_EVENT.COMPLETE_STREAM COMPLETE_STREAM
Event Name iOS Android Web/API
Complete Registration BranchStandardEventCompleteRegistration BRANCH_STANDARD_EVENT.COMPLETE_REGISTRATION COMPLETE_REGISTRATION
Complete Tutorial BranchStandardEventCompleteTutorial BRANCH_STANDARD_EVENT.COMPLETE_TUTORIAL COMPLETE_TUTORIAL
Achieve Level BranchStandardEventAchieveLevel BRANCH_STANDARD_EVENT.ACHIEVE_LEVEL ACHIEVE_LEVEL
Unlock Achievement BranchStandardEventUnlockAchievement BRANCH_STANDARD_EVENT.UNLOCK_ACHIEVEMENT UNLOCK_ACHIEVEMENT
Invite BranchStandardEventInvite BRANCH_STANDARD_EVENT.INVITE INVITE
Login BranchStandardEventLogin BRANCH_STANDARD_EVENT.LOGIN LOGIN
Start Trial BranchStandardEventStartTrial BRANCH_STANDARD_EVENT.START_TRIAL START_TRIAL
Subscribe BranchStandardEventSubscribe BRANCH_STANDARD_EVENT.SUBSCRIBE SUBSCRIBE
Opt In Tracked via handleATTAuthorizationStatus() Not Applicable Not Applicable
Opt Out Tracked via handleATTAuthorizationStatus() Not Applicable Not Applicable

Custom Events can be tracked if the event does not fall within one of the categories above.


Commerce Event 추적

Commerce Event는 사용자가 제품과 상호 작용하여 최종적으로 구매전환할 때까지 발생하는 일련의 행위들과 관련이 있습니다. 예를 들면 지불정보 추가, 구매 등이 있습니다. Branch Universal Ads(광고 어트리뷰션)를 활성화시킬 경우, 이러한 이벤트는 자동으로 특정 광고 파트너에 맵핑됩니다. 먼저 추적중인 이벤트와 연관된 각 제품에 해당되는 BranchUniversalLink를 생성하기 바랍니다.

그 다음 BranchUniversalObject를 추적할 이벤트에 추가하고 이벤트명은 사전 정의된 문자열 상수로 설정하기 바랍니다.예를 들면 아래 코드는 유저가 장바구니에 추가할 때 추적하는 것이지만 해당 이벤트명 관련상수를 다른 상수로 바꾸면 다른 이벤트를 추적할 수 있습니다.

통화 및 환율에 대한 참고 사항:
통화 없이 Commerce Event를 추적하는 경우 USD라고 가정합니다. USD 이외의 통화로 Commerce Event를 추적하는 경우 최근 환율을 사용하여 지정된 revenue를 USD로 변환합니다.

모든 단위는 달러이므로 이를 통해 여러 국가 및 통화에서 대시보드의 매출을 쉽게 시각화할 수 있습니다. 환율은 정기적으로 openexchangerates.org에서 인용되며 일반적으로 실시간 환율의 한 시간 이내입니다. 웹 후크 또는 내보내기를 통해 원시 Branch 이벤트를 보는 경우 사용된 환율을 볼 수 있습니다.

iOS - Commerce

// Create a BranchUniversalObject with your content data:
let branchUniversalObject = BranchUniversalObject.init()

// ...add data to the branchUniversalObject as needed...
branchUniversalObject.canonicalIdentifier = "item/12345"
branchUniversalObject.canonicalUrl        = "https://branch.io/item/12345"
branchUniversalObject.title               = "My Item Title"

branchUniversalObject.contentMetadata.contentSchema     = .commerceProduct
branchUniversalObject.contentMetadata.quantity          = 1
branchUniversalObject.contentMetadata.price             = 23.20
branchUniversalObject.contentMetadata.currency          = .USD
branchUniversalObject.contentMetadata.sku               = "1994320302"
branchUniversalObject.contentMetadata.productName       = "my_product_name1"
branchUniversalObject.contentMetadata.productBrand      = "my_prod_Brand1"
branchUniversalObject.contentMetadata.productCategory   = .apparel
branchUniversalObject.contentMetadata.productVariant    = "XL"
branchUniversalObject.contentMetadata.condition         = .new
branchUniversalObject.contentMetadata.customMetadata = [
            "custom_key1": "custom_value1",
            "custom_key2": "custom_value2"
        ]

// Create a BranchEvent:
let event = BranchEvent.standardEvent(.purchase)

// Add the BranchUniversalObject with the content (do not add an empty branchUniversalObject):
event.contentItems     = [ branchUniversalObject ]

// Add relevant event data:
event.alias            = "my custom alias"
event.transactionID    = "12344555"
event.currency         = .USD
event.revenue          = 1.5
event.shipping         = 10.2
event.tax              = 12.3
event.coupon           = "test_coupon"
event.affiliation      = "test_affiliation"
event.eventDescription = "Event_description"
event.searchQuery      = "item 123"
event.customData       = [
    "Custom_Event_Property_Key1": "Custom_Event_Property_val1",
    "Custom_Event_Property_Key2": "Custom_Event_Property_val2"
]
event.logEvent() // Log the event.
// Create a BranchUniversalObject with your content data:
BranchUniversalObject *branchUniversalObject = [BranchUniversalObject new];

// ...add data to the branchUniversalObject as needed...
branchUniversalObject.canonicalIdentifier = @"item/12345";
branchUniversalObject.canonicalUrl        = @"https://branch.io/item/12345";
branchUniversalObject.title               = @"My Item Title";

branchUniversalObject.contentMetadata.contentSchema     = BranchContentSchemaCommerceProduct;
branchUniversalObject.contentMetadata.quantity          = @"1";
branchUniversalObject.contentMetadata.price             = 23.20;
branchUniversalObject.contentMetadata.currency          = BNCCurrencyUSD;
branchUniversalObject.contentMetadata.sku               = @"1994320302";
branchUniversalObject.contentMetadata.productName       = @"my_product_name1";
branchUniversalObject.contentMetadata.productBrand      = @"my_prod_Brand1";
branchUniversalObject.contentMetadata.productCategory   = BNCProductCategoryApparel;
branchUniversalObject.contentMetadata.productVariant    = @"XL";
branchUniversalObject.contentMetadata.condition         = @"NEW";
branchUniversalObject.contentMetadata.customMetadata =  (NSMutableDictionary*) @{
    @"content_custom_key1": @"content_custom_value1",
    @"content_custom_key2": @"content_custom_value2"
};

// Create an event and add the BranchUniversalObject to it.
BranchEvent *event     = [BranchEvent standardEvent:BranchStandardEventAddToCart];

// Add the BranchUniversalObjects with the content (do not add an empty branchUniversalObject):
event.contentItems     = (id) @[ branchUniversalObject ];

// Add relevant event data:
event.alias            = "my custom alias";
event.transactionID    = @"12344555";
event.currency         = BNCCurrencyUSD;
event.revenue          = [NSDecimalNumber decimalNumberWithString:@"1.5"];
event.shipping         = [NSDecimalNumber decimalNumberWithString:@"10.2"];
event.tax              = [NSDecimalNumber decimalNumberWithString:@"12.3"];
event.coupon           = @"test_coupon";
event.affiliation      = @"test_affiliation";
event.eventDescription = @"Event_description";
event.searchQuery      = @"item 123";
event.customData       = (NSMutableDictionary*) @{
    @"Custom_Event_Property_Key1": @"Custom_Event_Property_val1",
    @"Custom_Event_Property_Key2": @"Custom_Event_Property_val2"
};
[event logEvent];

Android - Commerce

BranchUniversalObject buo = new BranchUniversalObject()
    .setCanonicalIdentifier("myprod/1234")
    .setCanonicalUrl("https://test_canonical_url")
    .setTitle("test_title")
    .setContentMetadata(
        new ContentMetadata()
        .addCustomMetadata("custom_metadata_key1", "custom_metadata_val1")
        .addCustomMetadata("custom_metadata_key1", "custom_metadata_val1")
        .addImageCaptions("image_caption_1", "image_caption2", "image_caption3")
        .setAddress("Street_Name", "test city", "test_state", "test_country", "test_postal_code")
        .setRating(5.2, 6.0, 5)
        .setLocation(-151.67, -124.0)
        .setPrice(10.0, CurrencyType.USD)
        .setProductBrand("test_prod_brand")
        .setProductCategory(ProductCategory.APPAREL_AND_ACCESSORIES)
        .setProductName("test_prod_name")
        .setProductCondition(ContentMetadata.CONDITION.EXCELLENT)
        .setProductVariant("test_prod_variant")
        .setQuantity(1.5)
        .setSku("test_sku")
        .setContentSchema(BranchContentSchema.COMMERCE_PRODUCT))
        .addKeyWord("keyword1")
        .addKeyWord("keyword2");

//  Do not add an empty branchUniversalObject to the BranchEvent

new BranchEvent(BRANCH_STANDARD_EVENT.ADD_TO_CART)
        .setAffiliation("test_affiliation")
        .setCustomerEventAlias("my_custom_alias")
        .setCoupon("Coupon Code")
        .setCurrency(CurrencyType.USD)
        .setDescription("Customer added item to cart")
        .setShipping(0.0)
        .setTax(9.75)
        .setRevenue(1.5)
        .setSearchQuery("Test Search query")
        .addCustomDataProperty("Custom_Event_Property_Key1", "Custom_Event_Property_val1")
        .addCustomDataProperty("Custom_Event_Property_Key2", "Custom_Event_Property_val2")
        .addContentItems(buo)
        .logEvent(context);

Web - Commerce

var event_and_custom_data = {
   "transaction_id": "tras_Id_1232343434",
   "currency": "USD",
   "revenue": 180.2,
   "shipping": 10.5,
   "tax": 13.5,
   "coupon": "promo-1234",
   "affiliation": "high_fi",
   "description": "Preferred purchase",
   "purchase_loc": "Palo Alto",
   "store_pickup": "unavailable"
};

var content_items = [
{
   "$content_schema": "COMMERCE_PRODUCT",
   "$og_title": "Nike Shoe",
   "$og_description": "Start loving your steps",
   "$og_image_url": "http://example.com/img1.jpg",
   "$canonical_identifier": "nike/1234",
   "$publicly_indexable": false,
   "$price": 101.2,
   "$locally_indexable": true,
   "$quantity": 1,
   "$sku": "1101123445",
   "$product_name": "Runner",
   "$product_brand": "Nike",
   "$product_category": "Sporting Goods",
   "$product_variant": "XL",
   "$rating_average": 4.2,
   "$rating_count": 5,
   "$rating_max": 2.2,
   "$creation_timestamp": 1499892854966,
   "$exp_date": 1499892854966,
   "$keywords": [ "sneakers", "shoes" ],
   "$address_street": "230 South LaSalle Street",
   "$address_city": "Chicago",
   "$address_region": "IL",
   "$address_country": "US",
   "$address_postal_code": "60604",
   "$latitude": 12.07,
   "$longitude": -97.5,
   "$image_captions": [ "my_img_caption1", "my_img_caption_2" ],
   "$condition": "NEW",
   "$custom_fields": {"foo1":"bar1","foo2":"bar2"}
},
{
   "$og_title": "Nike Woolen Sox",
   "$canonical_identifier": "nike/5324",
   "$og_description": "Fine combed woolen sox for those who love your foot",
   "$publicly_indexable": false,
   "$price": 80.2,
   "$locally_indexable": true,
   "$quantity": 5,
   "$sku": "110112467",
   "$product_name": "Woolen Sox",
   "$product_brand": "Nike",
   "$product_category": "Apparel & Accessories",
   "$product_variant": "Xl",
   "$rating_average": 3.3,
   "$rating_count": 5,
   "$rating_max": 2.8,
   "$creation_timestamp": 1499892854966
}];

var customer_event_alias = "my custom alias";

branch.logEvent(
   "PURCHASE",
   event_and_custom_data,
   content_items,
   customer_event_alias,
   function(err) { console.log(err); }
);

macOS

// Create a BranchUniversalObject with your content data:
        let branchUniversalObject = BranchUniversalObject.init()

        // ...add data to the branchUniversalObject as needed...
        branchUniversalObject.canonicalIdentifier = "item/12345"
        branchUniversalObject.canonicalUrl        = "https://branch.io/item/12345"
        branchUniversalObject.title               = "My Item Title"

        branchUniversalObject.contentMetadata.contentSchema     = .commerceProduct
        branchUniversalObject.contentMetadata.quantity          = 1
        branchUniversalObject.contentMetadata.price             = 23.20
        branchUniversalObject.contentMetadata.currency          = .USD
        branchUniversalObject.contentMetadata.sku               = "1994320302"
        branchUniversalObject.contentMetadata.productName       = "my_product_name1"
        branchUniversalObject.contentMetadata.productBrand      = "my_prod_Brand1"
        branchUniversalObject.contentMetadata.productCategory   = .apparel
        branchUniversalObject.contentMetadata.productVariant    = "XL"
        branchUniversalObject.contentMetadata.condition         = .new
        branchUniversalObject.contentMetadata.customMetadata = [
                    "custom_key1": "custom_value1",
                    "custom_key2": "custom_value2"
                ]

        // Create a BranchEvent:
        let event = BranchEvent.standardEvent(.purchase)

        // Add the BranchUniversalObject with the content (do not add an empty branchUniversalObject):
        event.contentItems     = [ branchUniversalObject ]

        // Add relevant event data:
        
        event.transactionID    = "12344555"
        event.currency         = .USD
        event.revenue          = 1.5
        event.shipping         = 10.2
        event.tax              = 12.3
        event.coupon           = "test_coupon"
        event.affiliation      = "test_affiliation"
        event.eventDescription = "Event_description"
        event.searchQuery      = "item 123"
        event.customData       = [
            "Custom_Event_Property_Key1": "Custom_Event_Property_val1",
            "Custom_Event_Property_Key2": "Custom_Event_Property_val2"
        ]
        
        // The log method is on the Branch singleton instead of the event object
        Branch.sharedInstance.logEvent(event) { (error) in
            // log error here
        }
// Create a BranchUniversalObject with your content data:
    BranchUniversalObject *branchUniversalObject = [BranchUniversalObject new];

    // ...add data to the branchUniversalObject as needed...
    branchUniversalObject.canonicalIdentifier = @"item/12345";
    branchUniversalObject.canonicalUrl        = @"https://branch.io/item/12345";
    branchUniversalObject.title               = @"My Item Title";

    branchUniversalObject.contentMetadata.contentSchema     = BranchContentSchemaCommerceProduct;
    
    branchUniversalObject.contentMetadata.quantity          = 1.0;

    branchUniversalObject.contentMetadata.price             = [NSDecimalNumber decimalNumberWithString:@"23.20"];
    
    branchUniversalObject.contentMetadata.currency          = BNCCurrencyUSD;
    branchUniversalObject.contentMetadata.sku               = @"1994320302";
    branchUniversalObject.contentMetadata.productName       = @"my_product_name1";
    branchUniversalObject.contentMetadata.productBrand      = @"my_prod_Brand1";
    branchUniversalObject.contentMetadata.productCategory   = BNCProductCategoryApparel;
    branchUniversalObject.contentMetadata.productVariant    = @"XL";
    branchUniversalObject.contentMetadata.condition         = @"NEW";
    branchUniversalObject.contentMetadata.customMetadata =  (NSMutableDictionary*) @{
        @"content_custom_key1": @"content_custom_value1",
        @"content_custom_key2": @"content_custom_value2"
    };

    // Create an event and add the BranchUniversalObject to it.
    BranchEvent *event     = [BranchEvent standardEvent:BranchStandardEventAddToCart];

    // Add the BranchUniversalObjects with the content (do not add an empty branchUniversalObject):
    event.contentItems     = (id) @[ branchUniversalObject ];

    // Add relevant event data:
    
    event.transactionID    = @"12344555";
    event.currency         = BNCCurrencyUSD;
    event.revenue          = [NSDecimalNumber decimalNumberWithString:@"1.5"];
    event.shipping         = [NSDecimalNumber decimalNumberWithString:@"10.2"];
    event.tax              = [NSDecimalNumber decimalNumberWithString:@"12.3"];
    event.coupon           = @"test_coupon";
    event.affiliation      = @"test_affiliation";
    event.eventDescription = @"Event_description";
    event.searchQuery      = @"item 123";
    event.customData       = (NSMutableDictionary*) @{
        @"Custom_Event_Property_Key1": @"Custom_Event_Property_val1",
        @"Custom_Event_Property_Key2": @"Custom_Event_Property_val2"
    };
    
    [[Branch sharedInstance] logEvent:event completion:^(NSError * _Nullable error) {
        NSLog(@"Test Standard Event: %@", error);
    }];

HTTP API - Commerce

엔드 포인트

POST /v2/event/standard
Content-Type: application/json

파라미터

필수 식별자에 대한 참고. (user_data에서) 다음을 보내야 합니다.

browser_fingerprint_id OR
os=iOS AND (idfa OR idfv) OR
os=Android AND (android_id or aaid)

curl -vvv -d '{
  "name": "PURCHASE",
  "customer_event_alias": "my custom alias",
  "user_data": {
    "os": "Android",
    "os_version": 25,
    "environment": "FULL_APP",
    "aaid": "abcdabcd-0123-0123-00f0-000000000000",
    "android_id": "a12300000000",
    "limit_ad_tracking": false,
    "developer_identity": "user123",
    "country": "US",
    "language": "en",
    "ip": "192.168.1.1",
    "local_ip": "192.168.1.2",
    "brand": "LGE",
    "app_version": "1.0.0",
    "model": "Nexus 5X",
    "screen_dpi": 420,
    "screen_height": 1794,
    "screen_width": 1080
  },
  "custom_data": {
    "purchase_loc": "Palo Alto",
    "store_pickup": "unavailable"
  },
  "event_data": {
    "transaction_id": "trans_Id_1232343434",
    "currency": "USD",
    "revenue": 180.2,
    "shipping": 10.5,
    "tax": 13.5,
    "coupon": "promo-1234",
    "affiliation": "high_fi",
    "description": "Preferred purchase"
  },
  "content_items": [
    {
      "$content_schema": "COMMERCE_PRODUCT",
      "$og_title": "Nike Shoe",
      "$og_description": "Start loving your steps",
      "$og_image_url": "http://example.com/img1.jpg",
      "$canonical_identifier": "nike/1234",
      "$publicly_indexable": false,
      "$price": 101.2,
      "$locally_indexable": true,
      "$quantity": 1,
      "$sku": "1101123445",
      "$product_name": "Runner",
      "$product_brand": "Nike",
      "$product_category": "Sporting Goods",
      "$product_variant": "XL",
      "$rating_average": 4.2,
      "$rating_count": 5,
      "$rating_max": 2.2,
      "$creation_timestamp": 1499892854966,
      "$exp_date": 1499892854966,
      "$keywords": [
        "sneakers",
        "shoes"
      ],
      "$address_street": "230 South LaSalle Street",
      "$address_city": "Chicago",
      "$address_region": "IL",
      "$address_country": "US",
      "$address_postal_code": "60604",
      "$latitude": 12.07,
      "$longitude": -97.5,
      "$image_captions": [
        "my_img_caption1",
        "my_img_caption_2"
      ],
      "$condition": "NEW",
      "$custom_fields": "{\"foo1\":\"bar1\",\"foo2\":\"bar2\"}"
    },
    {
      "$og_title": "Nike Woolen Sox",
      "$canonical_identifier": "nike/5324",
      "$og_description": "Fine combed woolen sox for those who love your foot",
      "$publicly_indexable": false,
      "$price": 80.2,
      "$locally_indexable": true,
      "$quantity": 5,
      "$sku": "110112467",
      "$product_name": "Woolen Sox",
      "$product_brand": "Nike",
      "$product_category": "Apparel & Accessories",
      "$product_variant": "Xl",
      "$rating_average": 3.3,
      "$rating_count": 5,
       "$rating_max": 2.8,
      "$creation_timestamp": 1499892854966
     }
   ],
   "metadata": {},
   "branch_key": "key_test_hdcBLUy1xZ1JD0tKg7qrLcgirFmPPVJc"
 }' https://api2.branch.io/v2/event/standard

전체 API 문서를 여기서 참조하세요.

Content Event 추적

Content Event는 사용자가 앱 내 콘텐츠에 대해 관심을 가지고 상호작용하는 행위를 취했을 때 전송하는 이벤트입니다. 예를 들면, 기사를 다루고 있는 앱에서 사용자가 콘텐츠를 검색하고, 읽고, 평가하고, 공유할 수 있습니다. 이는 블로그 게시물, 음악, 동영상, 사진, 전자상거래 카탈로그 항목 등 다양한 앱내 콘텐츠에 적용할 수 있습니다.

iOS - Content

let event = BranchEvent.standardEvent(.search)
event.alias = "my custom alias"
event.eventDescription = "Product Search"
event.searchQuery = "user search query terms for product xyz"
event.customData["Custom_Event_Property_Key1"] = "Custom_Event_Property_val1"
event.logEvent()
BranchEvent *event = [BranchEvent standardEvent:BranchStandardEventSearch];
event.alias = "my custom alias";
event.eventDescription = @"Product Search";
event.searchQuery = @"user search query terms for product xyz";
event.customData[@"Custom_Event_Property_Key1"] = @"Custom_Event_Property_val1";
[event logEvent];

Android - Content

new BranchEvent(BRANCH_STANDARD_EVENT.SEARCH)
  .setCustomerEventAlias("my_custom_alias")
  .setDescription("Product Search")
  .setSearchQuery("product name")
  .addCustomDataProperty("Custom_Event_Property_Key1", "Custom_Event_Property_val1")
  .logEvent(context);

Web - Content

var event_and_custom_data = {
   "transaction_id": "tras_Id_1232343434",
   "currency": "USD",
   "revenue": 180.2,
   "shipping": 10.5,
   "tax": 13.5,
   "coupon": "promo-1234",
   "affiliation": "high_fi",
   "description": "Preferred purchase",
   "purchase_loc": "Palo Alto",
   "store_pickup": "unavailable"
};

var content_items = [
{
   "$content_schema": "COMMERCE_PRODUCT",
   "$og_title": "Nike Shoe",
   "$og_description": "Start loving your steps",
   "$og_image_url": "http://example.com/img1.jpg",
   "$canonical_identifier": "nike/1234",
   "$publicly_indexable": false,
   "$price": 101.2,
   "$locally_indexable": true,
   "$quantity": 1,
   "$sku": "1101123445",
   "$product_name": "Runner",
   "$product_brand": "Nike",
   "$product_category": "Sporting Goods",
   "$product_variant": "XL",
   "$rating_average": 4.2,
   "$rating_count": 5,
   "$rating_max": 2.2,
   "$creation_timestamp": 1499892854966,
   "$exp_date": 1499892854966,
   "$keywords": [ "sneakers", "shoes" ],
   "$address_street": "230 South LaSalle Street",
   "$address_city": "Chicago",
   "$address_region": "IL",
   "$address_country": "US",
   "$address_postal_code": "60604",
   "$latitude": 12.07,
   "$longitude": -97.5,
   "$image_captions": [ "my_img_caption1", "my_img_caption_2" ],
   "$condition": "NEW",
   "$custom_fields": {"foo1":"bar1","foo2":"bar2"}
},
{
   "$og_title": "Nike Woolen Sox",
   "$canonical_identifier": "nike/5324",
   "$og_description": "Fine combed woolen sox for those who love your foot",
   "$publicly_indexable": false,
   "$price": 80.2,
   "$locally_indexable": true,
   "$quantity": 5,
   "$sku": "110112467",
   "$product_name": "Woolen Sox",
   "$product_brand": "Nike",
   "$product_category": "Apparel & Accessories",
   "$product_variant": "Xl",
   "$rating_average": 3.3,
   "$rating_count": 5,
   "$rating_max": 2.8,
   "$creation_timestamp": 1499892854966
}];

var customer_event_alias = "my custom alias";

branch.logEvent(
   "VIEW_ITEMS",
   event_and_custom_data,
   content_items,
   customer_event_alias,
   function(err) { console.log(err); }
);

HTTP API - Content

엔드 포인트

POST /v2/event/standard
Content-Type: application/json

파라미터

필수 식별자에 대한 참고. (user_data에서) 다음을 보내야 합니다.

browser_fingerprint_id OR
os=iOS AND (idfa OR idfv) OR
os=Android AND (android_id or aaid)

curl -vvv -d '{
  "name": "VIEW_ITEMS",
  "customer_event_alias": "my custom alias",
  "user_data": {
    "os": "Android",
    "os_version": 25,
    "environment": "FULL_APP",
    "aaid": "abcdabcd-0123-0123-00f0-000000000000",
    "android_id": "a12300000000",
    "limit_ad_tracking": false,
    "developer_identity": "user123",
    "country": "US",
    "language": "en",
    "ip": "192.168.1.1",
    "local_ip": "192.168.1.2",
    "brand": "LGE",
    "app_version": "1.0.0",
    "model": "Nexus 5X",
    "screen_dpi": 420,
    "screen_height": 1794,
    "screen_width": 1080
  },
  "custom_data": {
    "purchase_loc": "Palo Alto",
    "store_pickup": "unavailable"
  },
  "event_data": {
    "search_query": "red sneakers",
    "description": "Preferred purchase"
  },
  "content_items": [
    {
      "$content_schema": "COMMERCE_PRODUCT",
      "$og_title": "Nike Shoe",
      "$og_description": "Start loving your steps",
      "$og_image_url": "http://example.com/img1.jpg",
      "$canonical_identifier": "nike/1234",
      "$publicly_indexable": false,
      "$price": 101.2,
      "$locally_indexable": true,
      "$sku": "1101123445",
      "$product_name": "Runner",
      "$product_brand": "Nike",
      "$product_category": "Sporting Goods",
      "$product_variant": "XL",
      "$rating_average": 4.2,
      "$rating_count": 5,
      "$rating_max": 2.2,
      "$creation_timestamp": 1499892854966,
      "$exp_date": 1499892854966,
      "$keywords": [
        "sneakers",
        "shoes"
      ],
      "$address_street": "230 South LaSalle Street",
      "$address_city": "Chicago",
      "$address_region": "IL",
      "$address_country": "US",
      "$address_postal_code": "60604",
      "$latitude": 12.07,
      "$longitude": -97.5,
      "$image_captions": [
        "my_img_caption1",
        "my_img_caption_2"
      ],
      "$condition": "NEW",
      "$custom_fields": "{\"foo1\":\"bar1\",\"foo2\":\"bar2\"}"
    },
    {
      "$og_title": "Nike Woolen Sox",
      "$canonical_identifier": "nike/5324",
      "$og_description": "Fine combed woolen sox for those who love your foot",
      "$publicly_indexable": false,
      "$price": 80.2,
      "$locally_indexable": true,
      "$sku": "110112467",
      "$product_name": "Woolen Sox",
      "$product_brand": "Nike",
      "$product_category": "Apparel & Accessories",
      "$product_variant": "Xl",
      "$rating_average": 3.3,
      "$rating_count": 5,
      "$rating_max": 2.8,
      "$creation_timestamp": 1499892854966
    }
  ],
  "metadata": {},
  "branch_key": "key_test_hdcBLUy1xZ1JD0tKg7qrLcgirFmPPVJc"
}' https://api2.branch.io/v2/event/standard

전체 API 문서를 여기서 참조하세요.

Lifecycle Event 추적

Lifecycle Event는 사용자의 여정을 심화하기 위해 사용자가 단계별로 발생시키는 일련의 이벤트로 볼 수 있습니다. 이러한 이벤트는 사용자가 회원가입 또는 튜토리얼을 완료할 때 적용될 수 있고 게임 앱과 기타 유형의 앱에도 적용할 수 있습니다.

iOS - Lifecycle

let event = BranchEvent.standardEvent(.completeRegistration)
event.alias = "my custom alias"
event.transactionID = "tx1234"
event.eventDescription = "User completed registration."
event.customData["registrationID"] = "12345"
event.logEvent()
BranchEvent *event = [BranchEvent standardEvent:BranchStandardEventCompleteRegistration];
event.alias = "my custom alias";
event.transactionID = @"tx1234";
event.eventDescription = @"User completed registration.";
event.customData[@"registrationID"] = @"12345";
[event logEvent];

Android - Lifecycle

new BranchEvent(BRANCH_STANDARD_EVENT.COMPLETE_REGISTRATION)
    .setCustomerEventAlias("my_custom_alias")
    .setTransactionID("tx1234")
    .setDescription("User created an account")
    .addCustomDataProperty("registrationID", "12345")
    .logEvent(context);

Web - Lifecycle

var event_and_custom_data = {
   "transaction_id": "tras_Id_1234",
   "description": "Preferred purchase",
   "registration_id": "12345"
};

var customer_event_alias = "my custom alias";

branch.logEvent(
   "COMPLETE_REGISTRATION",
   event_and_custom_data,
   content_items,
   customer_event_alias,
   function(err) { console.log(err); }
);

HTTP API - Lifecycle

엔드 포인트

POST /v2/event/standard
Content-Type: application/json

파라미터

필수 식별자에 대한 참고. (user_data에서) 다음을 보내야 합니다.

browser_fingerprint_id OR
os=iOS AND (idfa OR idfv) OR
os=Android AND (android_id or aaid)

curl -vvv -d '{
  "name": "COMPLETE_REGISTRATION",
  "customer_event_alias": "my custom alias",
  "user_data": {
    "os": "Android",
    "os_version": 25,
    "environment": "FULL_APP",
    "aaid": "abcdabcd-0123-0123-00f0-000000000000",
    "android_id": "a12300000000",
    "limit_ad_tracking": false,
    "developer_identity": "user123",
    "country": "US",
    "language": "en",
    "ip": "192.168.1.1",
    "local_ip": "192.168.1.2",
    "brand": "LGE",
    "app_version": "1.0.0",
    "model": "Nexus 5X",
    "screen_dpi": 420,
    "screen_height": 1794,
    "screen_width": 1080
  },
  "custom_data": {
    "foo": "bar"
  },
  "event_data": {
    "description": "Preferred purchase"
  },
  "metadata": {},
  "branch_key": "key_test_hdcBLUy1xZ1JD0tKg7qrLcgirFmPPVJc"
}' https://api2.branch.io/v2/event/standard

전체 API 문서를 여기서 참조하세요.

Custom Event 추적

사전 정의된 표준 이벤트가 아닌 임의로 정의한 이벤트를 추적하려면 아래 내용을 참고하시기 바랍니다.

🚧

Custom Event 의 이벤트명

The name custom event is reserved by Branch. Please ensure you give your custom event an actual name.

Custom Event의 이벤트명은 문자, 숫자, 하이픈, 공백 및 밑줄만 포함한 40자 이하의 문자열을 사용할 것을 권장하고 하이픈으로 시작하지 않기 바랍니다. Facebook에서는 이러한 규칙을 위반하는 이벤트를 받아들이지 않을 것이고, Facebook 연동을 활성화하면, Branch에서 검증을 통해 유효하지 않는 이벤트를 수정할 수도 있습니다.

iOS - Custom

let event = BranchEvent.customEventWithName("User_Scanned_Item")
    event.customData["Custom_Event_Property_Key1"] = "Custom_Event_Property_val1"
    event.customData["Custom_Event_Property_Key2"] = "Custom_Event_Property_val2"
  event.alias = "my custom alias"
    event.logEvent()
BranchEvent *event = [BranchEvent customEventWithName:@"User_Scanned_Item"];
event.customData[@“Custom_Event_Property_Key1”] = @“Custom_Event_Property_val1";
event.customData[@“Custom_Event_Property_Key2”] = @“Custom_Event_Property_val2";
event.alias = "my custom alias";
[event logEvent];

Android - Custom

new BranchEvent("Some Custom Event")
    .addCustomDataProperty("Custom_Event_Property_Key11", "Custom_Event_Property_val11")
    .addCustomDataProperty("Custom_Event_Property_Key22", "Custom_Event_Property_val22")
    .setCustomerEventAlias("my_custom_alias")
    .logEvent(MainActivity.this);

Web - Custom

var custom_data = {
   "Custom_Event_Property_Key1": "Custom_Event_Property_val1",
   "Custom_Event_Property_Key2": "Custom_Event_Property_val2"
};

branch.logEvent(
    'custom_event_name',
    custom_data,
    function(err) { console.log(err); }
);

HTTP API - Custom

엔드 포인트

POST /v2/event/custom
Content-Type: application/json

파라미터

필수 식별자에 대한 참고. (user_data에서) 다음을 보내야 합니다.

browser_fingerprint_id OR
os=iOS AND (idfa OR idfv) OR
os=Android AND (android_id or aaid)

curl -vvv -d '{
  "name": "picture swiped",
  "customer_event_alias": "my custom alias",
  "user_data": {
    "os": "Android",
    "os_version": 25,
    "environment": "FULL_APP",
    "aaid": "abcdabcd-0123-0123-00f0-000000000000",
    "android_id": "a12300000000",
    "limit_ad_tracking": false,
    "developer_identity": "user123",
    "country": "US",
    "language": "en",
    "ip": "192.168.1.1",
    "local_ip": "192.168.1.2",
    "brand": "LGE",
    "app_version": "1.0.0",
    "model": "Nexus 5X",
    "screen_dpi": 420,
    "screen_height": 1794,
    "screen_width": 1080
  },
  "custom_data": {
    "foo": "bar"
  },
  "metadata": {},
  "branch_key": "key_test_hdcBLUy1xZ1JD0tKg7qrLcgirFmPPVJc"
}' https://api2.branch.io/v2/event/custom

전체 API 문서를 여기서 참조하세요.

이벤트 테스트

v2/이벤트가 Branch의 백엔드에서 수신되고 있는지 테스트하려면 Liveview를 확인하세요.

약 1개월 전에 업데이트 됨


Track Commerce, Content, Lifecycle and Custom Events


제안된 편집은 API 참조 페이지에서 제한됩니다.

Markdown 본문 콘텐츠에 대한 편집만 제안할 수 있지만 API 사양에는 제안할 수 없습니다.