@blotoutio/providers-google-analytics-4-sdk
Advanced tools
Comparing version 0.10.12 to 0.10.13
120
index.js
@@ -55,84 +55,94 @@ var ProvidersGoogleAnalytics4Sdk = (function () { | ||
const getEvent = (eventName, data, eventId) => { | ||
let event = eventName; | ||
let eventData = data || {}; | ||
switch (eventName) { | ||
case 'PageView': { | ||
event = 'page_view'; | ||
break; | ||
return { | ||
event: 'page_view', | ||
eventData: {}, | ||
}; | ||
} | ||
case 'ViewContent': { | ||
event = 'view_item'; | ||
eventData = { | ||
currency: data['currency'], | ||
value: data['value'], | ||
items: getItems(data['contents'], data['currency']), | ||
return { | ||
event: 'view_item', | ||
eventData: { | ||
currency: data['currency'], | ||
value: data['value'], | ||
items: getItems(data['contents'], data['currency']), | ||
}, | ||
}; | ||
break; | ||
} | ||
case 'AddToCart': { | ||
event = 'add_to_cart'; | ||
eventData = { | ||
currency: data['currency'], | ||
value: data['value'], | ||
items: getItems(data['contents'], data['currency']), | ||
return { | ||
event: 'add_to_cart', | ||
eventData: { | ||
currency: data['currency'], | ||
value: data['value'], | ||
items: getItems(data['contents'], data['currency']), | ||
}, | ||
}; | ||
break; | ||
} | ||
case 'InitiateCheckout': { | ||
event = 'begin_checkout'; | ||
eventData = { | ||
currency: data['currency'], | ||
value: data['value'], | ||
items: getItems(data['contents'], data['currency']), | ||
return { | ||
event: 'begin_checkout', | ||
eventData: { | ||
currency: data['currency'], | ||
value: data['value'], | ||
items: getItems(data['contents'], data['currency']), | ||
}, | ||
}; | ||
break; | ||
} | ||
case 'AddShippingInfo': { | ||
event = 'add_shipping_info'; | ||
eventData = { | ||
currency: data['currency'], | ||
value: data['value'], | ||
items: getItems(data['contents'], data['currency']), | ||
return { | ||
event: 'add_shipping_info', | ||
eventData: { | ||
currency: data['currency'], | ||
value: data['value'], | ||
items: getItems(data['contents'], data['currency']), | ||
}, | ||
}; | ||
break; | ||
} | ||
case 'AddPaymentInfo': { | ||
event = 'add_payment_info'; | ||
eventData = { | ||
currency: data['currency'], | ||
value: data['value'], | ||
items: getItems(data['contents'], data['currency']), | ||
return { | ||
event: 'add_payment_info', | ||
eventData: { | ||
currency: data['currency'], | ||
value: data['value'], | ||
items: getItems(data['contents'], data['currency']), | ||
}, | ||
}; | ||
break; | ||
} | ||
case 'Purchase': { | ||
event = 'purchase'; | ||
eventData = { | ||
currency: data['currency'], | ||
transaction_id: data['orderId'] || eventId, | ||
value: data['value'], | ||
items: getItems(data['contents'], data['currency']), | ||
return { | ||
event: 'purchase', | ||
eventData: { | ||
currency: data['currency'], | ||
transaction_id: data['orderId'] || eventId, | ||
value: data['value'], | ||
items: getItems(data['contents'], data['currency']), | ||
}, | ||
}; | ||
break; | ||
} | ||
case 'Search': { | ||
event = 'search'; | ||
eventData = { | ||
search_term: data['search'], | ||
return { | ||
event: 'search', | ||
eventData: { | ||
search_term: data['search'], | ||
}, | ||
}; | ||
break; | ||
} | ||
case 'Lead': { | ||
event = 'generate_lead'; | ||
eventData = { | ||
currency: data['currency'], | ||
value: data['value'], | ||
return { | ||
event: 'generate_lead', | ||
eventData: { | ||
currency: data['currency'], | ||
value: data['value'], | ||
}, | ||
}; | ||
break; | ||
} | ||
default: { | ||
return { | ||
event: eventName, | ||
eventData: data, | ||
}; | ||
} | ||
} | ||
return { | ||
event, | ||
eventData, | ||
}; | ||
}; | ||
@@ -181,3 +191,3 @@ const handleTag = ({ data = {}, eventName, eventId, manifestVariables, }) => { | ||
loaded: isLoaded, | ||
sdkVersion: "0.10.12" , | ||
sdkVersion: "0.10.13" , | ||
}; | ||
@@ -184,0 +194,0 @@ }; |
{ | ||
"name": "@blotoutio/providers-google-analytics-4-sdk", | ||
"version": "0.10.12", | ||
"version": "0.10.13", | ||
"description": "Google Analytics 4 Browser SDK for EdgeTag", | ||
@@ -5,0 +5,0 @@ "author": "Blotout", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
7458
206