• 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 4 years, 8 months ago by Jmac1337.
Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Support mbrsolution

    (@mbrsolution)

    Hi, are you wanting to monitor your purchases via Google Analytics?

    Thank you

    Thread Starter Jmac1337

    (@jmac1337)

    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 4 years, 7 months ago by Jmac1337.
    Plugin Author mra13

    (@mra13)

    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/

    You can create a custom little plugin that listens to that hook and then do the e-commerce tracking.

    Thread Starter Jmac1337

    (@jmac1337)

    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.