• Hello,

    I have a problem with data layer. It is most likely implemented by plugin but as I see in source code, data layers occurs more than once. The first one looks like bellow:

    var gtm4wp_datalayer_name = "dataLayer";
    	var dataLayer = dataLayer || [];
    	const gtm4wp_use_sku_instead        = 0;
    	const gtm4wp_id_prefix              = '';
    	const gtm4wp_remarketing            = false;
    	const gtm4wp_eec                    = 1;
    	const gtm4wp_classicec              = false;
    	const gtm4wp_currency               = 'PLN';
    	const gtm4wp_product_per_impression = 10;
    	const gtm4wp_needs_shipping_address = false;
    	const gtm4wp_business_vertical      = 'retail';
    	const gtm4wp_business_vertical_id   = 'id';

    And the second one:

    const console_cmd = console.warn || console.log;
    	var dataLayer_content = {"pagePostType":"product","pagePostType2":"single-product","customerTotalOrders":0,"customerTotalOrderValue":"0.00","customerFirstName":"","customerLastName":"","customerBillingFirstName":"","customerBillingLastName":"","customerBillingCompany":"","customerBillingAddress1":"","customerBillingAddress2":"","customerBillingCity":"","customerBillingPostcode":"","customerBillingCountry":"","customerBillingEmail":"","customerBillingEmailHash":"e3b0c442989c8996fb92427ae41e4649b934ca495991b7852b855","customerBillingPhone":"","customerShippingFirstName":"","customerShippingLastName":"","customerShippingCompany":"","customerShippingAddress1":"","customerShippingAddress2":"","customerShippingCity":"","customerShippingPostcode":"","customerShippingCountry":"","cartContent":{"totals":{"applied_coupons":[],"discount_total":0,"subtotal":0,"total":0},"items":[]},"productRatingCounts":[],"productAverageRating":0,"productReviewCount":0,"productType":"variable","productIsVariable":1,"ecomm_prodid":99471,"ecomm_pagetype":"product","ecomm_totalvalue":137};
    	dataLayer.push( dataLayer_content );

    I am using GTM4WP plugin so it’s probable that one of above is implemented by that. But I don’t know which one and how to merge this two into one. When I am working with GTM on preview mode I don’t see data from first data layer. So I couldn’t use for example currency because this value doesn’t appear in the second data layer. How could I solve this problem?

    • This topic was modified 2 years, 5 months ago by Jan Dembowski. Reason: Moved to Fixing WordPress, this is not an Developing with WordPress topic
    • This topic was modified 2 years, 5 months ago by James Huff.
    • This topic was modified 2 years, 5 months ago by James Huff.
  • The topic ‘Double data layer implementation’ is closed to new replies.