Home / Widgets / Add tracking pixel / javascript on modal checkout complete | Display Eventbrite
Duplicate Snippet

Embed Snippet on Your Site

Add tracking pixel / javascript on modal checkout complete | Display Eventbrite

Enable addition javascript to be executed on Eventbrite Modal Order Complete, this can be use for conversion pixels and tracking code

You can also use the script to redirect to a thank-you page but there are some issues
1. EB have a thank-you part of the modal and that disappears a bit quick if you don't add a delay
2. Browsers ask if you want to leave the page which would impact usability - this can be overridden

This is an example of a redirect with both issues dealt with

This action is available from version 5.5.6 of Display Eventbrite

Code Preview
php
<?php
add_action( 'wfea_popup_scripts_enqueued', function () {
		$script = '
		    window.onbeforeunload = null; // set to null to avoid a message about leaving the page before saved - use if redirecting
            wfeaModalCallback = function () {
                console.log("There has been an Eventbrite checkout.");
                
                //  add your conversion tracking code here or relocation code
                // Waits 3 seconds (3000 milliseconds) before redirecting  because there is a screen after order complete
            setTimeout(function() {
                window.location.replace("https://example.com/thank-you-for-registering/");
            }, 3000);
                // end of tracking code
             };';
		wp_add_inline_script( 'widget-for-eventbrite-api-eb-popup', $script, 'after' );
	} );

Comments

Add a Comment