I hope all the experts are doing well. I am seeking a solution for my client's WordPress WooCommerce website, https://brille-klubben.dk. I need to track purchase events on the website. While I have tried several methods, I have been able to track begin_checkout data successfully. However, my client uses a custom redirection to another thank you page, which the GTM4WP or PixelYourSite plugins cannot track.
Considering this, I am considering manually implementing the data layer on the thank you page. I am not very familiar with this technical aspect, and I'm wondering if anyone can assist me in writing the code to replace the dynamic code for printing product information.
Thank you for your time and expertise.
Here is the demo code, I need to replace static data with dynamic.
{
event: "purchase",
gsm: {uniqueEventId: 6, start: 1625823263950},
ecommerce: {
transaction_id: 174,
affiliation: "Online Store",
value: "2660",
tax: "0",
shipping: null,
currency: "BDT",
coupon: ",
items: [
{
item_name: "Printed Kurta",
item_id: 34,
price: 2660,
item_brand: "Gulljee",
item_category: "UNSTITCHED",
item_variant: "",
quantity: 1
}
]
}
}
Datalayer for WooCommerce Purchase tracking for custom order received page!