google analytics - How to send concurrent queries with dataLayer for product details and products listing? -
i'm setting ecommerce tracking google analytics , google tag manager.
one every product details page, have listings - "family products" , "similar products".
what right way send products details , these 2 listings? i'm using different datalayer events, not seem work right.
first in code have:
$(function () { datalayer.push({ 'ecommerce': { 'event': 'productdetailview', 'currencycode': 'bgn', 'detail': { 'products': [ { 'name': 'product 1', 'id': 'pr-1', 'price': 19.80, 'category': 'category / subcategory' } ] ... });
and later in code have:
$(function () { datalayer.push({ 'ecommerce': { 'event': 'showfamilylisting', 'currencycode': 'bgn', 'impressions': [ { "name": 'product 5', "id": 'pr-5', "price": '88.10', 'category': 'category / subcategory', 'list': 'family products', 'position': 1 }, { "name": 'product 7', "id": 'pr-7', "price": '88.10', 'category': 'category / subcategory', 'list': 'family products', 'position': 2 },
and after next listing:
$(function () { datalayer.push({ 'ecommerce': { 'event': 'showsimilarslisting', 'currencycode': 'bgn', 'impressions': [ { "name": 'product 19', "id": 'pr-19', "price": '18.10', 'category': 'category / subcategory', 'list': 'similar products', 'position': 1 }, { "name": 'product 17', "id": 'pr-17', "price": '18.10', 'category': 'category / subcategory', 'list': 'similar products', 'position': 2 },
it seems last query being received google analytics, products details data , first listing being skipped.
i have analytics tag set trigger these events (productdetailview, showfamilylisting, showsimilarslisting) , "all pages dom"..
thanks
only recent ecommerce object included in hit!
in other words, if 2 consecutive datalayer.push() commands own ‘ecommerce’ objects, tag fires after latter push have access latter ‘ecommerce’ object.
Comments
Post a Comment