Skip to content

Commit

Permalink
Add coupon code to ADD_TO_CART and PURCHASE events
Browse files Browse the repository at this point in the history
  • Loading branch information
amedina-branch authored Feb 29, 2024
1 parent 239231f commit 94103bc
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions branch_events.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ function trackEvent(eventName) {
if (eventName == "ADD_TO_CART") {
var event_and_custom_data = {
"currency": "EUR",
"revenue": 120.0
"revenue": 120.0,
"coupon": "coupon_code"
};

var customer_event_alias = "Test currency + revenue fields";
var customer_event_alias = "Test currency + revenue + coupon fields";

branch.logEvent(
"ADD_TO_CART",
Expand All @@ -14,15 +15,16 @@ function trackEvent(eventName) {
function(err) { console.log(err); }
);

setTimeout(function(){alert("Branch " + eventName + " event was tracked with currency and revenue data!")},500);
setTimeout(function(){alert("Branch " + eventName + " event was tracked with currency, revenue, and coupon data!")},500);
}
else if(eventName == "PURCHASE") {
var event_and_custom_data = {
"currency": "EUR",
"revenue": 120.0
"revenue": 120.0,
"coupon": "coupon_code"
};

var customer_event_alias = "Test currency + revenue fields";
var customer_event_alias = "Test currency + revenue + coupon fields";

branch.logEvent(
"PURCHASE",
Expand All @@ -31,7 +33,7 @@ function trackEvent(eventName) {
function(err) { console.log(err); }
);

setTimeout(function(){alert("Branch " + eventName + " event was tracked with currency and revenue data!")},500);
setTimeout(function(){alert("Branch " + eventName + " event was tracked with currency, revenue, and coupon data!")},500);

}
else {
Expand Down

0 comments on commit 94103bc

Please sign in to comment.