I've tried many different permutations of gtag and ga codes and I can't seem to get a positive conversion on Google Analytics.
This code runs on form submit and the Google Ad conversion in the first line registers a positive conversion in that platform. Google Analytics is what isn't showing the goal.
I'm NOT using the Google Tag Manager, but including the following global tag.
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'XXXXXXXX');
</script>
As you can see here the lines I've marked as the attempts are as follows:
// This Google Ad Conversion works properly
gtag('event', 'conversion', {'send_to': 'XXXXXXXX'});
// Attempt 1
gtag('event', 'Submit', { 'event_category': 'Form', 'event_label': 'Outdoor Kitchens Landing Oct 2019', 'value': 1 });
// Attempt 2
ga('send', 'event', 'Form', 'Submit', 'Outdoor Kitchens Landing Oct 2019', 1);
// Attempt 3
ga('send', {
hitType: 'event',
eventCategory: 'Form',
eventAction: 'Submit',
eventLabel: 'Outdoor Kitchens Landing Oct 2019',
eventValue: 1
});
In order to make the ga code work, I had to include the following snippet in the HEAD.
<script>
window['GoogleAnalyticsObject'] = 'ga';
window['ga'] = window['ga'] || function() {
(window['ga'].q = window['ga'].q || []).push(arguments)
};
</script>
The setup of the goal in Google Analytics is as follows (the label that is cut off reads "Outdoor Kitchens Landing Oct 2019"
Consider adding gtag('config', 'UA-XXXXX-Y')
call to initiate analytics tracking and following the official documentation on analytics event tracking: https://developers.google.com/analytics/devguides/collection/gtagjs/events
From what I see on your site, the analytics tracker object is never initiated so no data are sent to Analytics.
You need gtag('config', ... )
call for each service you're using like one for Ads conversions and another for Analytics: https://developers.google.com/gtagjs/devguide/configure
also, your MonsterInsights code might affect tracking so check if it works as intended.