You can use JavaScript to execute tracking codes such as Facebook Pixel or Google Analytics.
If you are comfortable with JavaScript, you can use MutationObserver() to watch for the PlaceFull booking confirmation page to display. After it does, you can run your desired tracking code. In the following example, after the booking confirmation page displays, a pop-up alert displays 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. This example uses the confirmation page that displays after a booking purchase (without using the shopping cart). Then, replace the window.alert() with the code you want to run, such as a tracking code.
Add the completed block of code to the same page where you added the PlaceFull embed code.
Comments
0 comments
Please sign in to leave a comment.