-
Title:
Checkout steps code
-
Description:
-
As your user progresses through
the steps in the checkout process,
-
your app needs to send
an analytics hit for each step.
-
However, you only need one checkout hit.
-
So subsequent steps in the checkout
process, send checkout option hits.
-
So that you don't over report
the number of checkouts.
-
And use the setCheckoutStep
method to set the step number.
-
And you can set the number
to whatever you want, but
-
it only shows up in the checkout
behavior analysis report in
-
the google analytics dashboard
if you set a funnel step for it.
-
If i set the step in the code to 99, but
I've only labeled 4 checkouts steps in
-
the admin console, I will never see
the 99th step in the dashboard, so
-
that's just not a good idea.
-
That's better.
-
So go ahead and add a second step to
the checkout process for the dinner app.
-
For that you're going to
need a payment button.
-
So add another button to the order
dinner screen labelled payment.
-
And in the order dinner activity,
add the method to get the payment info.
-
Then send a step two hit to analytics.
-
Make sure to set the action
to an ACTION_CHECKOUT_OPTION.
-
Show the payment button
only when relevant and
-
hide the other buttons when
the payment button appears.
-
Test your app and try it out.
-
And in the analytics dashboard,
look for the realtime activity.
-
And in the realtime activity,
check for the events.
-
See, here's the Get payment step.
-
It might take a good amount of time
after you see the realtime hits for
-
the checkout behavior
analysis page to update.
-
But when it does,
you should see your new payment step.
-
Oh, something went wrong.
-
I got a hit for getting the address,
but not forgetting the payment details.
-
That's not what I wanted.
-
Okay that happened because step
one is starting checkout and
-
step two is getting the address.
-
Step three is getting
the payment details.
-
That's easy to fix for now.
-
Go to Admin > Ecommerce, and
-
I'm just going to remove
the Get address final step.
-
Yep, I'll delete this rule.
-
And submit, and go back to Reporting,
and look at that.
-
The get address step is gone,
and I've got my payment details.
-
And I know that that is correct,
in this case.
-
An alternative would be to change
the step number to three in the code.
-
But then we would be
skipping over step two.
-
So we would have values here,
nothing here, values here.
-
So when you set your check out step in
the code, you need to make sure that it
-
mapped the correct final step
in the analytic dashboard.
-
So make sure step two is in fact
the payment step, and if not, fix it.
-
So go ahead and do these steps and
check the boxes when you're done.