A
A
Arx7772015-10-19 11:41:24
Google Analytics
Arx777, 2015-10-19 11:41:24

Make advanced e-commerce?

It is necessary to set up advanced e-commerce through TGM for YM and GA
0) dataEcommerce in this form
f9e3d2d0949843f18d565aeceb22bd26.png
1) I pass the array $data//dataEcommerce to TGM

<script>dataEcommerce = [<?=json_encode($data)?>];</script>
<!-- Google Tag Manager -->
    <noscript><iframe src="//www.googletagmanager.com/ns.html?id=<?=Configure::read('GoogleTagManager')?>"
                      height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
    <script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
            new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
            j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
            '//www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
    })(window,document,'script','dataEcommerce','<?=Configure::read('GoogleTagManager')?>');</script>
<!-- End Google Tag Manager -->

2) tag for YM set up like this
214a3eb82d0644419f83110f18788105.png
<!-- Yandex.Metrika counter -->
<script type="text/javascript">
    (function (d, w, c) {
        (w[c] = w[c] || []).push(function() {
            try {
                w.yaCounter32547095 = new Ya.Metrika({
                    id:32547095,
                    clickmap:true,
                    trackLinks:true,
                    accurateTrackBounce:true,
                  	ecommerce: 'dataEcommerce'
                });
            } catch(e) { }
        });

        var n = d.getElementsByTagName("script")[0],
            s = d.createElement("script"),
            f = function () { n.parentNode.insertBefore(s, n); };
        s.type = "text/javascript";
        s.async = true;
        s.src="https://mc.yandex.ru/metrika/watch.js";

        if (w.opera == "[object Opera]") {
            d.addEventListener("DOMContentLoaded", f, false);
        } else { f(); }
    })(document, window, "yandex_metrika_callbacks");
</script>
<noscript><div><img src="https://mc.yandex.ru/watch/32547095" style="position:absolute; left:-9999px;" alt="" /></div></noscript>
<!-- /Yandex.Metrika counter -->

3) for GA tag set up like this
0b76c182c68849d9a0e943baa7627918.png
4) tags work on the page
d3bb09cc4d474d0286b292f43512a361.png
But not in YM not in GA orders do not fall

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim Bukei, 2015-10-29
@maxgabba

I think that there are several implicit points that are little described in the counter documentation:

  1. To transfer enhanced electronic commerce (EEC) to GTM, you must use not a transaction! Transaction - this is for the accounting of transactions for regular electronic commerce. And you need to use the page view with the transfer of data about the EEC. Read more here . Configuration: Tag type : Universal Analytics, Track type : Pageview, Enable Enhanced Ecommerce Features: true, Use Data Layer: true, Basic Settings - Document Path: {{url path}}, Firing Rule: {{event}} equals gtm. dom
  2. If you want to use not dataLayer, but something else, then the setting looks something like this. 50920cd3880f420f969b93c8e73278c5.pngYou just need to substitute your variable passed to GTM
  3. It is better to initialize a variable like this window.dataLayer = window.dataLayer || []; because it will not be overwritten with such initialization.
  4. After these settings, data transfer to GA should work
  5. For NM, the setting implies mandatory initialization of the variable https://yandex.ru/support/metrika/data/e-commerce.... followed by pushing data into it.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question