{"id":301,"date":"2021-11-23T08:22:11","date_gmt":"2021-11-23T08:22:11","guid":{"rendered":"http:\/\/wappoblog.lndo.site\/?post_type=docs_wappo&p=301"},"modified":"2021-11-25T12:05:53","modified_gmt":"2021-11-25T12:05:53","slug":"tracking-google-analytics","status":"publish","type":"docs_wappo","link":"https:\/\/wappoblog.lndo.site\/docs\/tracking-google-analytics\/","title":{"rendered":"Tracking with Google Analytics"},"content":{"rendered":"\n

Tracking results when you have a website is key to success, as it will allow you to gather data about the performance of your website, and make sure that each parts is efficient.<\/p>\n\n\n\n

Well your booking form is no different, and with Wappointment you are able to measure conversion with a bit of PHP and Javascript.<\/p>\n\n\n\n

Track new bookings<\/h2>\n\n\n\n

Within your active’s theme functions.php<\/strong>, add the following code, making sure you replace the code between the two comments \/\/START code<\/strong> and \/\/END code<\/strong>. (you should put your Google Analytics or Google Tag tracking code here or any other script you want to use to track the event)<\/p>\n\n\n\n

In this example, we are redirecting your user to a specific webpage and we display the information that is available to you within your browser’s console.<\/p>\n\n\n\n

function my_wappo_analytics_appointment_confirmed()\n{\n\n  echo '<script>';\n  echo "document.addEventListener('wappo_confirmed', function (e) {\n              \/\/START code\n              window.location.replace('https:\/\/mysite.com\/myurl');\n              console.log('appointment Data', e.wdata )\n              \/\/END code\n            }, false);";\n  echo '<\/script>';\n}\nadd_action('wp_print_footer_scripts', 'my_wappo_analytics_appointment_confirmed');<\/code><\/pre>\n\n\n\n

Track rescheduling event<\/h2>\n\n\n\n

Using a very similar example you can also track rescheduling events.<\/p>\n\n\n\n

function my_wappo_analytics_appointment_rescheduled()\n{\n\n  echo '<script>';\n  echo "document.addEventListener('wappo_rescheduled', function (e) {\n              \/\/START code \n              window.location.replace('https:\/\/mysite.com\/myurl');\n              console.log('appointment Data', e.wdata )\n              \/\/END code\n            }, false);";\n  echo '<\/script>';\n}\nadd_action('wp_print_footer_scripts', 'my_wappo_analytics_appointment_rescheduled');<\/code><\/pre>\n\n\n\n

<\/p>\n","protected":false},"template":"","tags":[],"uagb_featured_image_src":[],"uagb_author_info":{"display_name":"Ben","author_link":"https:\/\/wappoblog.lndo.site\/author\/"},"uagb_comment_info":0,"uagb_excerpt":"Tracking results when you have a website is key to success, as it will allow you to gather data about the performance of your website, and make sure that each parts is efficient. Well your booking form is no different, and with Wappointment you are able to measure conversion with a bit of PHP and…","_links":{"self":[{"href":"https:\/\/wappoblog.lndo.site\/wp-json\/wp\/v2\/docs_wappo\/301"}],"collection":[{"href":"https:\/\/wappoblog.lndo.site\/wp-json\/wp\/v2\/docs_wappo"}],"about":[{"href":"https:\/\/wappoblog.lndo.site\/wp-json\/wp\/v2\/types\/docs_wappo"}],"wp:attachment":[{"href":"https:\/\/wappoblog.lndo.site\/wp-json\/wp\/v2\/media?parent=301"}],"wp:term":[{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wappoblog.lndo.site\/wp-json\/wp\/v2\/tags?post=301"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}