analytics.js-integration-google-analytics
analytics.js-integration-google-analytics copied to clipboard
Google Analytics Integration extractCheckoutOptions bug, Impact Checkout Step Viewed and Completed
Base on the documentation:
https://segment.com/docs/spec/ecommerce/v2/#checkout-step-viewed https://segment.com/docs/spec/ecommerce/v2/#checkout-step-completed
The checkout options are to be returned in this format:
analytics.track('Checkout Step Completed', {
checkout_id: '50314b8e9bcf000000000000',
step: 2,
shipping_method: 'Fedex',
payment_method: 'Visa'
});
However the Google Analytics Integration is coded to look for these value in that format
analytics.track('Checkout Step Completed', {
checkout_id: '50314b8e9bcf000000000000',
step: 2,
shipping_method: 'Fedex',
payment_method: 'Visa'
});
See code https://github.com/segment-integrations/analytics.js-integration-google-analytics/blob/master/lib/index.js#L903
function extractCheckoutOptions(props) {
var options = [
props.paymentMethod,
props.shippingMethod
];
// Remove all nulls, and join with commas.
var valid = reject(options);
return valid.length > 0 ? valid.join(', ') : null;
}
good catch! @hankim813 can we switch to case-insensitive lookups there via regex or direct fallbacks?
@sperand-io if these are spec'd properties of an ecommerce event, we should update the facade dependency to add shippingMethod()
and paymentMethod()
to .track()
messages that covers all the cases
thoughts @tsholmes ?
@hankim813 yeah if they are spec'd ecommerce props, we should have a facade method for them that runs it through proxy
to avoid casing issues
@sperand-io EPD-510 <-- created ticket internally to track this issue. Should be a simple fix.