Title: Include custom variable in Datalayer
Last modified: February 7, 2018

---

# Include custom variable in Datalayer

 *  [Lucius](https://wordpress.org/support/users/allenraysales/)
 * (@allenraysales)
 * [8 years, 3 months ago](https://wordpress.org/support/topic/include-custom-variable-in-datalayer/)
 * I’m trying to add Google Reviews into our e-commerce website and it requires 
   3 additional variables that doesn’t appear to be in the datalayer.
 * These are countrycode, customeremail, and shipdate.
 * Is there a way to easily push them to the datalayer? customeremail appears to
   be setup already as it is displaying but with no email value when we use a guest
   checkout (not logged in) process.
 * Info on this is appreciated.
 * Thanks,
 * Al

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

 *  Plugin Author [Thomas Geiger](https://wordpress.org/support/users/duracelltomi/)
 * (@duracelltomi)
 * [8 years, 3 months ago](https://wordpress.org/support/topic/include-custom-variable-in-datalayer/#post-9950900)
 * Hi,
 * The next version of the plugin will include most of this data except for order
   delivery date. With the next plugin version on the order received page, you will
   have several new variables to use:
 * – customerBillingCountry or customerShippingCountry
    – customerBillingEmail
 * Order delivery date is usually an average, you may want to generate this by yourself
   based on the current date and adding an average number of days.
 * I hope that helps.
 *  Thread Starter [Lucius](https://wordpress.org/support/users/allenraysales/)
 * (@allenraysales)
 * [8 years, 3 months ago](https://wordpress.org/support/topic/include-custom-variable-in-datalayer/#post-9954318)
 * Much appreciated for your time and dedication to this plugin! Very excited for
   this update.
 * Cheers,
 * Allen
 *  [Vishal Kothari](https://wordpress.org/support/users/ashokrane/)
 * (@ashokrane)
 * [8 years, 3 months ago](https://wordpress.org/support/topic/include-custom-variable-in-datalayer/#post-9956204)
 * Hi [@allenraysales](https://wordpress.org/support/users/allenraysales/),
 * When you talk of Ship date, are you using a plugin like the [Order Delivery Date](https://wordpress.org/plugins/order-delivery-date-for-woocommerce/)?
   We are the authors of that plugin, hence the question.
 * [@duracelltomi](https://wordpress.org/support/users/duracelltomi/), I would be
   happy to integrate our plugin with yours, so it can show the Order delivery date
   from our plugin on the order received page.
 * Please let me know if there is a guide or instructions that we should follow 
   in order to make the integration.
 * :Vishal
 *  Thread Starter [Lucius](https://wordpress.org/support/users/allenraysales/)
 * (@allenraysales)
 * [8 years, 3 months ago](https://wordpress.org/support/topic/include-custom-variable-in-datalayer/#post-9958108)
 * Thanks Vishal will check this out.
 * Cheers,
 * Al
 *  Plugin Author [Thomas Geiger](https://wordpress.org/support/users/duracelltomi/)
 * (@duracelltomi)
 * [8 years, 3 months ago](https://wordpress.org/support/topic/include-custom-variable-in-datalayer/#post-9960800)
 * [@ashokrane](https://wordpress.org/support/users/ashokrane/) that is quite easy,
   use the GTM4WP_WPFILTER_COMPILE_DATALAYER constant or reference directly the 
   gtm4wp_compile_datalayer filter name to hook into the data layer building process.
 * If the user is on the order received page, you can use this filter to add the
   order delivery date if my plugin is active:
 *     ```
       function your_datalayer_hook( $dataLayer ) {
         $dataLayer["orderDeliveryDate"] = "your value";
   
         return $dataLayer;
       }
       add_filter( GTM4WP_WPFILTER_COMPILE_DATALAYER, "your_datalayer_hook" );
       ```
   
 * Does this help?

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

The topic ‘Include custom variable in Datalayer’ 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/)

## Tags

 * [data layer](https://wordpress.org/support/topic-tag/data-layer/)

 * 5 replies
 * 3 participants
 * Last reply from: [Thomas Geiger](https://wordpress.org/support/users/duracelltomi/)
 * Last activity: [8 years, 3 months ago](https://wordpress.org/support/topic/include-custom-variable-in-datalayer/#post-9960800)
 * Status: not resolved