Use JavaScript to execute tracking codes such as a "Facebook Pixel" or "Google Analytics".
When a PlaceFull embed code is used, the end of the checkout process displays a confirmation message, but doesn't re-direct the consumer to another location. The consumer should remain on the merchant's own website.
If you are comfortable with JavaScript, you can use the MutationObserver()
to watch for the PlaceFull purchase confirmation page to show up, and then run your desired tracking code when that happens.
Here is an example script to observe a booking confirmation page and then display a pop-up alert with a thank you message.
var ranPfConfirmTracker = false; function thankYouOnPurchase() { var pfEmbed = window.parent.document.getElementById("pf-root"); var config = { attributes: false, childList: true, subtree: true }; var waitForConfirmation = function (mutationsList) { for (var mutation of mutationsList) { var confirmation = document.querySelector("#pf-all > div > div:nth-child(8)"); if ( ranPfConfirmTracker == false && confirmation != null && confirmation.innerHTML != "" ) { window.alert("Thank you for making a purchase!"); ranPfConfirmTracker = true; } } }; var observer = new MutationObserver(waitForConfirmation); observer.observe(pfEmbed, config); } thankYouOnPurchase();
Make sure the query selector is what you want exactly (this example is the confirmation page after a booking purchase without using the shopping cart), and replace the window.alert() with whatever code you wanted to run, such as a tracking code.
Add the completed block of code into the same web page where the PlaceFull embed code has been added.
Comments
0 comments
Please sign in to leave a comment.