GTM push is including previous checkout inside the purchase





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







0















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
}
]
}
}


}










share|improve this question





























    0















    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
    }
    ]
    }
    }


    }










    share|improve this question

























      0












      0








      0








      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
      }
      ]
      }
      }


      }










      share|improve this question














      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






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 16 '18 at 18:47









      tebownertebowner

      307




      307
























          1 Answer
          1






          active

          oldest

          votes


















          1














          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.






          share|improve this answer
























            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
            });


            }
            });














            draft saved

            draft discarded


















            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









            1














            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.






            share|improve this answer




























              1














              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.






              share|improve this answer


























                1












                1








                1







                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.






                share|improve this answer













                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.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Nov 19 '18 at 15:26









                IgorKolIgorKol

                856




                856
































                    draft saved

                    draft discarded




















































                    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.




                    draft saved


                    draft discarded














                    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





















































                    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







                    Popular posts from this blog

                    Bressuire

                    Vorschmack

                    Quarantine