Custom Events on Google Analytics for VOW Sign Up
In our listings product, we fire custom events if we detect the presence of Google Analytics by using this code:
window.dataLayer.push( {
event: 'formSubmitted',
formURL: window.location.href,
formName: _this.name || '',
title: document.title,
})
It's described by google here: https://developers.google.com/analytics/devguides/collection/ga4/events?client_type=gtag
"formName" field may be one of the following:
-
InlineContactForm
-
ContactListingForm
-
*SendListingForm
-
*VowLoginForm
-
*VowListingFavoriteForm
-
*VowSignupForm
-
*VowContactForm
Here is also an example of "feeding" the form submit into GA on your own (replace GA number in the code below):
window.mrp_v2_ready( function() {
_gmrp.$(document).on( "mrp:form-submitted", function(event,data) {
if( data && data.form === "VowSignupForm" ) {
console.log( 'VOW SIGNUP DETECTED' );
gtag('event', 'conversion', {'send_to': 'AW-xxxxxx'});
}
});
});
});
Alternatively, you may use the easier way:
(event.detail will contain {title, formName, formURL})
// for website forms
window.addEventListener("mrp.webFormSubmitted", function(event) {
gtag_report_conversion( event.detail.formURL );
// or your own processing
});
// for listing forms
window.addEventListener("mrp.formSubmitted", function(event) {
gtag_report_conversion( event.detail.formURL );
// or your own processing
});