Multiple checkout_option options in GA Advanced Ecommerce

What would be the best way to register multiple parameters for one validation step with GA Advanced e-commerce?

As described in the documentation:

// Called when user has completed shipping options.
function onShippingComplete(stepNumber, shippingOption) {
  ga('ec:setAction', 'checkout_option', {
    'step': stepNumber,
    'option': shippingOption
  });

  ga('send', 'event', 'Checkout', 'Option', {
     hitCallback: function() {
       // Advance to next page.
     }
  });
}

      

The problem is that we collect shipping and payment method in one step, and we would like to track both selections. Here's our initial idea:

// Called when user has completed shipping and payment options.
function onStepComplete(stepNumber, shippingOption,paymentOption ) {
  ga('ec:setAction', 'checkout_option', {
    'step': stepNumber,
    'option': shippingOption
  });

ga('ec:setAction', 'checkout_option', {
    'step': stepNumber,
    'option': paymentOption
  });

  ga('send', 'event', 'Checkout', 'Option', {
     hitCallback: function() {
       // Advance to next page.
     }
  });
}

      

Will this work as expected? Can we then segment correctly?

+3


source to share


3 answers


Change checkout_option to checkout . It looks like Google is handling two separate types of events and what data is required for each to work in enhanced ecommerce. I faced the same issues myself and was able to fix this issue.

An example based on your code:



    // Called when user has completed shipping and payment options.
function onStepComplete(stepNumber, shippingOption,paymentOption ) {
  ga('ec:setAction', 'checkout', {
    'step': stepNumber,
    'option': shippingOption
  });

ga('ec:setAction', 'checkout', {
    'step': stepNumber,
    'option': paymentOption
  });

  ga('send', 'event', 'checkout', 'option', {
     hitCallback: function() {
       // Advance to next page.
     }
  });
}

      

+1


source


I am afraid the options are exclusive and act as a dimension in the new enhanced funnel reports from GA. If you want to analyze which shipping method works best, you cannot mix it together with the payment method, both must be of different sizes as the measurement values โ€‹โ€‹are exclusive.

I would separate shipping and payment in two separate steps, each with its own shipping / payment measurements, even if you have a onestep checkout (quite normal these days) you can create as many steps as you like.



Take a look at the extended demo ecommerce store , here they represent the payment methods in step 2, but when the user clicks on the selector to select Visa / transfer / etc, step 3 will be created.

0


source


each step only allows 1 measurement. The solution is to create sub-steps, and when running 2 sub-steps, remember to send 2 events instead of 1, otherwise the last one will be overwritten.

Here he is:

                    async.parallel([
                    function shippingOption(callback) {
                        ga('ec:setAction', 'checkout_option', {
                            'step': 1,
                            'option': shippingOption
                        });
                        ga('send', 'event', 'Checkout', 'Option', {
                            hitCallback: callback(null, true)
                        });

                    },
                    function paymentOption(callback) {
                        ga('ec:setAction', 'checkout_option', {
                            'step': 2,
                            'option': paymentOption
                        });                                                
                        ga('send', 'event', 'Checkout', 'Option', {
                            hitCallback: callback(null, true)                                
                        })
                    }
                ], function(err, hitCallback){
                   // do something like going to next page
                })

      

0


source







All Articles