How to set up Google Analytics Goal for ajax form submissions

前端 未结 3 491
难免孤独
难免孤独 2021-02-02 09:40

I have a contact form that is submitted via ajax and upon a successful submission, a thank you/success message is displayed.

Additionally, I\'ve set up a goal (Goal Comp

3条回答
  •  清酒与你
    2021-02-02 10:02

    Here's an updated answer for 2019. Linking up your Analytics account to Google Tag Manager lets you track submissions on AJAX forms in Google Analytics by either tracking all form submissions or by setting an event listener to an element's visibility (i.e. your form's confirmation/thank you message). It requires use of the newer Global Site Tag (gtag.js) and Google Tag Manager.

    This tutorial does an outstanding job of explaining the process and walks through setting up a Google Analytics Goal on a form submitted via AJAX or where tracking a redirect/changed URL isn't an option.

提交回复
热议问题