Forum Replies Created

Viewing 3 replies - 1 through 3 (of 3 total)
  • 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

    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.
    Thread Starter Jmac1337

    (@jmac1337)

    Im using dailypost theme, it seems to be quite oddly made- not the usual coding design i am used to

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