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