GTM push is including previous checkout inside the purchase
google tag manager - i am calling a checkout and then a purchase consecutively... It seems the "checkout" portion is included in the final "purchase".
see the results from this below.......... i get the first checkout event fine. the second event for purchase contains the first checkout json?
try {
dataLayer.push({
'event': 'ecommerce_checkout',
'eventCategory': 'Ecommerce',
'eventAction': 'Checkout',
'ecommerce': {
'checkout': {
'actionField': {
'step': 5,
'option': 'checkoutstep5'
},
'products': [{
'name': 'test',
'id': 10101,
'category': 'Testing',
}]
}
}
}); } catch (egtm) {}
try {
dataLayer.push({
'event': 'ecommerce_purchase',
'eventCategory': 'Ecommerce',
'eventAction': 'Purchase',
'ecommerce': {
'purchase': {
'actionField': {
'id': 111,
'revenue': 10
},
'products': [{
'name': 'test',
'id': 10101,
'price': 10,
'category': 'test',
'variant': 'test',
'quantity': 1
}]
}
}
}); } catch (egtm) {}
Resulting GTM :
{
gtm: {start: 11111111111, uniqueEventId: 429},
event: 'ecommerce_purchase',
eventCategory: 'Ecommerce',
eventAction: 'Purchase',
ecommerce: {
checkout: {
actionField: {step: 5, option: 'checkoutstep5'},
products: [
{
name: 'test',
id: 10101,
category: 'Testing',
price: '10',
variant: '',
quantity: 1
}
]
},
purchase: {
actionField: {id: '145245', revenue: '10.00'},
products: [
{
name: 'test',
id: 10101,
category: 'Testing',
price: '10',
variant: '',
quantity: 1
}
]
}
}
}
google-tag-manager
add a comment |
google tag manager - i am calling a checkout and then a purchase consecutively... It seems the "checkout" portion is included in the final "purchase".
see the results from this below.......... i get the first checkout event fine. the second event for purchase contains the first checkout json?
try {
dataLayer.push({
'event': 'ecommerce_checkout',
'eventCategory': 'Ecommerce',
'eventAction': 'Checkout',
'ecommerce': {
'checkout': {
'actionField': {
'step': 5,
'option': 'checkoutstep5'
},
'products': [{
'name': 'test',
'id': 10101,
'category': 'Testing',
}]
}
}
}); } catch (egtm) {}
try {
dataLayer.push({
'event': 'ecommerce_purchase',
'eventCategory': 'Ecommerce',
'eventAction': 'Purchase',
'ecommerce': {
'purchase': {
'actionField': {
'id': 111,
'revenue': 10
},
'products': [{
'name': 'test',
'id': 10101,
'price': 10,
'category': 'test',
'variant': 'test',
'quantity': 1
}]
}
}
}); } catch (egtm) {}
Resulting GTM :
{
gtm: {start: 11111111111, uniqueEventId: 429},
event: 'ecommerce_purchase',
eventCategory: 'Ecommerce',
eventAction: 'Purchase',
ecommerce: {
checkout: {
actionField: {step: 5, option: 'checkoutstep5'},
products: [
{
name: 'test',
id: 10101,
category: 'Testing',
price: '10',
variant: '',
quantity: 1
}
]
},
purchase: {
actionField: {id: '145245', revenue: '10.00'},
products: [
{
name: 'test',
id: 10101,
category: 'Testing',
price: '10',
variant: '',
quantity: 1
}
]
}
}
}
google-tag-manager
add a comment |
google tag manager - i am calling a checkout and then a purchase consecutively... It seems the "checkout" portion is included in the final "purchase".
see the results from this below.......... i get the first checkout event fine. the second event for purchase contains the first checkout json?
try {
dataLayer.push({
'event': 'ecommerce_checkout',
'eventCategory': 'Ecommerce',
'eventAction': 'Checkout',
'ecommerce': {
'checkout': {
'actionField': {
'step': 5,
'option': 'checkoutstep5'
},
'products': [{
'name': 'test',
'id': 10101,
'category': 'Testing',
}]
}
}
}); } catch (egtm) {}
try {
dataLayer.push({
'event': 'ecommerce_purchase',
'eventCategory': 'Ecommerce',
'eventAction': 'Purchase',
'ecommerce': {
'purchase': {
'actionField': {
'id': 111,
'revenue': 10
},
'products': [{
'name': 'test',
'id': 10101,
'price': 10,
'category': 'test',
'variant': 'test',
'quantity': 1
}]
}
}
}); } catch (egtm) {}
Resulting GTM :
{
gtm: {start: 11111111111, uniqueEventId: 429},
event: 'ecommerce_purchase',
eventCategory: 'Ecommerce',
eventAction: 'Purchase',
ecommerce: {
checkout: {
actionField: {step: 5, option: 'checkoutstep5'},
products: [
{
name: 'test',
id: 10101,
category: 'Testing',
price: '10',
variant: '',
quantity: 1
}
]
},
purchase: {
actionField: {id: '145245', revenue: '10.00'},
products: [
{
name: 'test',
id: 10101,
category: 'Testing',
price: '10',
variant: '',
quantity: 1
}
]
}
}
}
google-tag-manager
google tag manager - i am calling a checkout and then a purchase consecutively... It seems the "checkout" portion is included in the final "purchase".
see the results from this below.......... i get the first checkout event fine. the second event for purchase contains the first checkout json?
try {
dataLayer.push({
'event': 'ecommerce_checkout',
'eventCategory': 'Ecommerce',
'eventAction': 'Checkout',
'ecommerce': {
'checkout': {
'actionField': {
'step': 5,
'option': 'checkoutstep5'
},
'products': [{
'name': 'test',
'id': 10101,
'category': 'Testing',
}]
}
}
}); } catch (egtm) {}
try {
dataLayer.push({
'event': 'ecommerce_purchase',
'eventCategory': 'Ecommerce',
'eventAction': 'Purchase',
'ecommerce': {
'purchase': {
'actionField': {
'id': 111,
'revenue': 10
},
'products': [{
'name': 'test',
'id': 10101,
'price': 10,
'category': 'test',
'variant': 'test',
'quantity': 1
}]
}
}
}); } catch (egtm) {}
Resulting GTM :
{
gtm: {start: 11111111111, uniqueEventId: 429},
event: 'ecommerce_purchase',
eventCategory: 'Ecommerce',
eventAction: 'Purchase',
ecommerce: {
checkout: {
actionField: {step: 5, option: 'checkoutstep5'},
products: [
{
name: 'test',
id: 10101,
category: 'Testing',
price: '10',
variant: '',
quantity: 1
}
]
},
purchase: {
actionField: {id: '145245', revenue: '10.00'},
products: [
{
name: 'test',
id: 10101,
category: 'Testing',
price: '10',
variant: '',
quantity: 1
}
]
}
}
}
google-tag-manager
google-tag-manager
asked Nov 16 '18 at 18:47
tebowner
207
207
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
You can clean the dataLayer before you get to the Purchase by doing another dataLayer.push with the ecommerce : undefined .
On the other side, you want dataLayer to have the information about the transaction on the Checkout completed, so that you can send it to GA or some other tracking engine, right? In that case, you need only to get the values from ecommerce.purchase variable, and you don't need to worry about ecommerce.checkout still being there as it is not messing up anything for you anyway.
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53343728%2fgtm-push-is-including-previous-checkout-inside-the-purchase%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
You can clean the dataLayer before you get to the Purchase by doing another dataLayer.push with the ecommerce : undefined .
On the other side, you want dataLayer to have the information about the transaction on the Checkout completed, so that you can send it to GA or some other tracking engine, right? In that case, you need only to get the values from ecommerce.purchase variable, and you don't need to worry about ecommerce.checkout still being there as it is not messing up anything for you anyway.
add a comment |
You can clean the dataLayer before you get to the Purchase by doing another dataLayer.push with the ecommerce : undefined .
On the other side, you want dataLayer to have the information about the transaction on the Checkout completed, so that you can send it to GA or some other tracking engine, right? In that case, you need only to get the values from ecommerce.purchase variable, and you don't need to worry about ecommerce.checkout still being there as it is not messing up anything for you anyway.
add a comment |
You can clean the dataLayer before you get to the Purchase by doing another dataLayer.push with the ecommerce : undefined .
On the other side, you want dataLayer to have the information about the transaction on the Checkout completed, so that you can send it to GA or some other tracking engine, right? In that case, you need only to get the values from ecommerce.purchase variable, and you don't need to worry about ecommerce.checkout still being there as it is not messing up anything for you anyway.
You can clean the dataLayer before you get to the Purchase by doing another dataLayer.push with the ecommerce : undefined .
On the other side, you want dataLayer to have the information about the transaction on the Checkout completed, so that you can send it to GA or some other tracking engine, right? In that case, you need only to get the values from ecommerce.purchase variable, and you don't need to worry about ecommerce.checkout still being there as it is not messing up anything for you anyway.
answered Nov 19 '18 at 15:26
IgorKol
856
856
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53343728%2fgtm-push-is-including-previous-checkout-inside-the-purchase%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown