Title: DataLayer Push?
Last modified: March 31, 2020

---

# DataLayer Push?

 *  [Jmac1337](https://wordpress.org/support/users/jmac1337/)
 * (@jmac1337)
 * [6 years, 2 months ago](https://wordpress.org/support/topic/datalayer-push/)
 * Hey!
 * I was wondering if you push any information into the dataLayer on successful 
   transactions?
 * I’m looking to send transaction data to Google Analytics eCommerce.
 * If yes, do you have a screenshot of what this looks like?
 * Thanks!
    J
    -  This topic was modified 6 years, 2 months ago by [Jmac1337](https://wordpress.org/support/users/jmac1337/).

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

 *  Plugin Support [mbrsolution](https://wordpress.org/support/users/mbrsolution/)
 * (@mbrsolution)
 * [6 years, 2 months ago](https://wordpress.org/support/topic/datalayer-push/#post-12628855)
 * Hi, are you wanting to monitor your purchases via Google Analytics?
 * Thank you
 *  Thread Starter [Jmac1337](https://wordpress.org/support/users/jmac1337/)
 * (@jmac1337)
 * [6 years, 2 months ago](https://wordpress.org/support/topic/datalayer-push/#post-12629462)
 * Yes that is correct.
 * Im hoping to dynamically track product purchases by grabbing the information 
   in a dataLayer which has been pushed in on successful purchases.
 * Does your plugin do that or would it be able to with a little tweak?
 * Thanks
    -  This reply was modified 6 years, 2 months ago by [Jmac1337](https://wordpress.org/support/users/jmac1337/).
 *  Plugin Author [mra13 / Team Tips and Tricks HQ](https://wordpress.org/support/users/mra13/)
 * (@mra13)
 * [6 years, 2 months ago](https://wordpress.org/support/topic/datalayer-push/#post-12632623)
 * I don’t know anything about “DataLayer Push”. The best way to do the analytics
   tracking would be to hook into the post payment processing hook.
 * The page explains the action hook that is triggered after the payment is completed:
   
   [https://s-plugins.com/stripe-payments-plugin-action-hooks-reference/](https://s-plugins.com/stripe-payments-plugin-action-hooks-reference/)
 * You can create a custom little plugin that listens to that hook and then do the
   e-commerce tracking.
 *  Thread Starter [Jmac1337](https://wordpress.org/support/users/jmac1337/)
 * (@jmac1337)
 * [6 years, 2 months ago](https://wordpress.org/support/topic/datalayer-push/#post-12642728)
 * Thanks for your reply.
 * The problem is I am not a php developer so I’m not sure where to start with your
   code 🙁
 * But maybe if I explain what I am looking to achieve you might be able to provide
   a solution….
 * Essentially I want to put the information that is captured by Stripe into a javascript
   object which I can then send to Google Analytics. It looks like this:
 * <script>
    window.dataLayer = window.dataLayer || []; dataLayer.push({ ‘event’:‘
   purchase’, ‘transactionId’: ‘1234’, ‘transactionAffiliation’: ‘Acme Clothing’,‘
   transactionTotal’: 38.26, ‘transactionTax’: 1.29, ‘transactionShipping’: 5, ‘
   transactionProducts’: [{ ‘sku’: ‘DD44’, ‘name’: ‘T-Shirt’, ‘category’: ‘Apparel’,‘
   price’: 11.99, ‘quantity’: 1 },{ ‘sku’: ‘AA1243544’, ‘name’: ‘Socks’, ‘category’:‘
   Apparel’, ‘price’: 9.99, ‘quantity’: 2 }] }); </script>
 * The idea is to populate each key (e.g. TransactionID, transactionTotal etc) dynamically
   based on what someone has purchased.
 * From what I understand you have sent me the php function is that can retrieve
   the information from Stripe after a successful transaction.. Seeing as though
   you are the developer wizard compared to me, is there any way you would be able
   to piece these two things together for me please?
 * Specially, what the code would look like if the php function ran with the output
   being this javascript object I have shown above?
 * Thank you so much in advance
 * J

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

The topic ‘DataLayer Push?’ is closed to new replies.

 * ![](https://ps.w.org/stripe-payments/assets/icon-128x128.png?rev=2705524)
 * [Accept Stripe Payments](https://wordpress.org/plugins/stripe-payments/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/stripe-payments/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/stripe-payments/)
 * [Active Topics](https://wordpress.org/support/plugin/stripe-payments/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/stripe-payments/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/stripe-payments/reviews/)

 * 4 replies
 * 3 participants
 * Last reply from: [Jmac1337](https://wordpress.org/support/users/jmac1337/)
 * Last activity: [6 years, 2 months ago](https://wordpress.org/support/topic/datalayer-push/#post-12642728)
 * Status: not resolved