Title: Empty dataLayer data
Last modified: April 17, 2020

---

# Empty dataLayer data

 *  [78mails](https://wordpress.org/support/users/78mails/)
 * (@78mails)
 * [6 years, 1 month ago](https://wordpress.org/support/topic/empty-datalayer-data/)
 * Hi, Thomas! Can you, please, help me with my project.
    I add GTM code to header.
   php and install your plugin, but after purchase that is no data in dataLayer.
   I have such code: <!doctype html> <html lang=”uk”> <head> <meta charset=”UTF-
   8″> <meta name=”viewport” content=”width=device-width, initial-scale=1″> <link
   rel=”profile” href=”[http://gmpg.org/xfn/11″&gt](http://gmpg.org/xfn/11″&gt);
   <!– Google Tag Manager –> <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= ‘
   [https://www.googletagmanager.com/gtm.js?id=’+i+dl;f.parentNode.insertBefore(j,f)](https://www.googletagmanager.com/gtm.js?id=’+i+dl;f.parentNode.insertBefore(j,f));})(
   window,document,’script’,’dataLayer’,’GTM-KNZRN52′);</script> <!– End Google 
   Tag Manager –> <title>Оформлення замовлення</title>
 * <!– Google Tag Manager for WordPress by gtm4wp.com –>
    <script data-cfasync=”
   false” data-pagespeed-no-defer type=”text/javascript”>//<![CDATA[ var gtm4wp_datalayer_name
   = “dataLayer”; var dataLayer = dataLayer || []; var gtm4wp_use_sku_instead = 
   0; var gtm4wp_id_prefix = ”; var gtm4wp_remarketing = false; var gtm4wp_eec =
   false; var gtm4wp_classicec = 1; var gtm4wp_currency = ‘UAH’; var gtm4wp_product_per_impression
   = 0; var gtm4wp_needs_shipping_address = false; //]]> </script> <!– End Google
   Tag Manager for WordPress by gtm4wp.com –><link rel=’dns-prefetch’ href=’//fonts.
   googleapis.com’ />
 * Please help! Thank you!
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fempty-datalayer-data%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 9 replies - 1 through 9 (of 9 total)

 *  Plugin Author [Thomas Geiger](https://wordpress.org/support/users/duracelltomi/)
 * (@duracelltomi)
 * [6 years, 1 month ago](https://wordpress.org/support/topic/empty-datalayer-data/#post-12696153)
 * Hi,
 * Your order received page will not include the purchase data after it has been
   loaded once with a specific order ID. Any subsequent page loads for the same 
   order ID will omit the transaction data to make sure it is not getting tracked
   twice or more times.
 * If the first page load still does not include the proper data, that could be 
   because of several reasons:
    – using any 3rd party plugin to alter the default
   layout and flow of the WooCommerce checkout page – using any 3rd party plugin
   to create a customized order received page – trying to combine the cart and the
   checkout page into one page – having a 3rd party payment gateway altering the
   default WooCommerce checkout flow
 *  Thread Starter [78mails](https://wordpress.org/support/users/78mails/)
 * (@78mails)
 * [6 years, 1 month ago](https://wordpress.org/support/topic/empty-datalayer-data/#post-12709929)
 * Hi, Thomas! Can you please check out my website. I’m disable all plugins except
   woocommerce & your plugin. Also I install clean theme Storefronte.
    But I still
   does not see the proper data in dataLayer.
 * Thank you!
 *  Thread Starter [78mails](https://wordpress.org/support/users/78mails/)
 * (@78mails)
 * [6 years, 1 month ago](https://wordpress.org/support/topic/empty-datalayer-data/#post-12711342)
 * Hi!
 * I set up only free shipping and payment after receiving the goods.
    This is screenshots
   of my set ups: [https://agromint.com.ua/wp-content/uploads/2020/04/21312.png](https://agromint.com.ua/wp-content/uploads/2020/04/21312.png)
   [https://agromint.com.ua/wp-content/uploads/2020/04/5656.png](https://agromint.com.ua/wp-content/uploads/2020/04/5656.png)
   [https://agromint.com.ua/wp-content/uploads/2020/04/78765.png](https://agromint.com.ua/wp-content/uploads/2020/04/78765.png)
 * This is the code I add to header.php:
    <?php /** * The header for our theme. **
   Displays all of the <head> section and everything up till <div id=”content”> **
   [@package](https://wordpress.org/support/users/package/) storefront */
 * ?><!doctype html>
    <html <?php language_attributes(); ?>> <head> <meta charset
   =”<?php bloginfo( ‘charset’ ); ?>”> <meta name=”viewport” content=”width=device-
   width, initial-scale=1, maximum-scale=2.0″> <link rel=”profile” href=”[http://gmpg.org/xfn/11″&gt](http://gmpg.org/xfn/11″&gt);
   <link rel=”pingback” href=”<?php bloginfo( ‘pingback_url’ ); ?>”>
 * <!– Google Tag Manager –>
    <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= ‘
   [https://www.googletagmanager.com/gtm.js?id=’+i+dl;f.parentNode.insertBefore(j,f)](https://www.googletagmanager.com/gtm.js?id=’+i+dl;f.parentNode.insertBefore(j,f));})(
   window,document,’script’,’dataLayer’,’GTM-KNZRN52′);</script> <!– End Google 
   Tag Manager –>
 * <?php wp_head(); ?>
    </head>
 * <body <?php body_class(); ?>>
 *  <?php if ( function_exists( ‘gtm4wp_the_gtm_tag’ ) ) { gtm4wp_the_gtm_tag();}?
   >
    <!– Google Tag Manager (noscript) –> <noscript><iframe src=”[https://www.googletagmanager.com/ns.html?id=GTM-KNZRN52&#8243](https://www.googletagmanager.com/ns.html?id=GTM-KNZRN52&#8243);
   height=”0″ width=”0″ style=”display:none;visibility:hidden”></iframe></noscript
   > <!– End Google Tag Manager (noscript) –>
 * <?php wp_body_open(); ?>
 * <?php do_action( ‘storefront_before_site’ ); ?>
 * <div id=”page” class=”hfeed site”>
    <?php do_action( ‘storefront_before_header’);?
   >
 * Please help! Thank you!
 *  Plugin Author [Thomas Geiger](https://wordpress.org/support/users/duracelltomi/)
 * (@duracelltomi)
 * [6 years, 1 month ago](https://wordpress.org/support/topic/empty-datalayer-data/#post-12711360)
 * Currently, you have added the GTM container code fully manually into your theme,
   _before_ GTM4WP will add the necessary data layer data into your site.
 * I placed a test order and on the order received page, I can see this
 * #1 your GTM container code is loading first
    #2 GTM4WP pushes classic/standard(
   not enhanced!) ecommerce data into the data layer #3 GA pageview is tracked #
   4 GA classic/standard transaction is tracked (!)
 * Order #1827 has been transmitted to GA after placing my test order
 * May I ask you why you have added the GTM container code manually into your theme?
 *  Thread Starter [78mails](https://wordpress.org/support/users/78mails/)
 * (@78mails)
 * [6 years, 1 month ago](https://wordpress.org/support/topic/empty-datalayer-data/#post-12711862)
 * I used the instructions from the Internet, but the truth was there were settings
   for enhanced ecommerce. But our the analyst claims that he needs the classic 
   version for analysis.
 * Please poke my nose on how to properly configure your plugin to receive order
   data. I’m already completely confused. I apologize (
 *  Thread Starter [78mails](https://wordpress.org/support/users/78mails/)
 * (@78mails)
 * [6 years, 1 month ago](https://wordpress.org/support/topic/empty-datalayer-data/#post-12721223)
 * Hi, Thomas! Can you, please, help me?
 *  Plugin Author [Thomas Geiger](https://wordpress.org/support/users/duracelltomi/)
 * (@duracelltomi)
 * [6 years, 1 month ago](https://wordpress.org/support/topic/empty-datalayer-data/#post-12728854)
 * Hi,
 * We need to clean this step by step.
 * First: you should remove the hard coded GTM container code from your site and
   allow GTM4WP to properly add the container code. You can safely use the codeless
   placement option as this should work with your theme.
 * Then, you will need to enable enhanced ecommerce tracking to have a more granular
   data about ecommerce actions in GA.
 * Please review this setup article and setup your tracking according to the steps:
   
   [https://gtm4wp.com/how-to-articles/how-to-setup-enhanced-ecommerce-tracking](https://gtm4wp.com/how-to-articles/how-to-setup-enhanced-ecommerce-tracking)
 *  Thread Starter [78mails](https://wordpress.org/support/users/78mails/)
 * (@78mails)
 * [6 years ago](https://wordpress.org/support/topic/empty-datalayer-data/#post-12777236)
 * Hi, Thomas! Thank you so much! It works! I’m happy)))
 * Can you, please, give me advice on how to display order data on the custom thank
   you page?
 *  Plugin Author [Thomas Geiger](https://wordpress.org/support/users/duracelltomi/)
 * (@duracelltomi)
 * [6 years ago](https://wordpress.org/support/topic/empty-datalayer-data/#post-12778713)
 * The key with custom thankyou pages is that you need to mimic all the behavior
   of the standard thank you page:
 * – use a WP hook to tell plugins that “this” page is the order received page:
   
   [https://github.com/woocommerce/woocommerce/blob/dd49f89e77acaaa097251fe0a5dd69320ded48c6/includes/wc-conditional-functions.php#L223](https://github.com/woocommerce/woocommerce/blob/dd49f89e77acaaa097251fe0a5dd69320ded48c6/includes/wc-conditional-functions.php#L223)
 * – include the same order ID and key data in the URL as the default order received
   page
 * This should make GTM4WP able to show the order data

Viewing 9 replies - 1 through 9 (of 9 total)

The topic ‘Empty dataLayer data’ is closed to new replies.

 * ![](https://ps.w.org/duracelltomi-google-tag-manager/assets/icon-256x256.png?
   rev=1708451)
 * [GTM4WP - A Google Tag Manager (GTM) plugin for WordPress](https://wordpress.org/plugins/duracelltomi-google-tag-manager/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/duracelltomi-google-tag-manager/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/duracelltomi-google-tag-manager/)
 * [Active Topics](https://wordpress.org/support/plugin/duracelltomi-google-tag-manager/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/duracelltomi-google-tag-manager/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/duracelltomi-google-tag-manager/reviews/)

 * 9 replies
 * 2 participants
 * Last reply from: [Thomas Geiger](https://wordpress.org/support/users/duracelltomi/)
 * Last activity: [6 years ago](https://wordpress.org/support/topic/empty-datalayer-data/#post-12778713)
 * Status: not resolved