View Categories

How do I set up Google Analytics (GA4) event tracking?

2 min read

To set up a goal on Google Analytics 4 (GA4) using the provided script, follow these step-by-step instructions:
 
Step 1: Google site tag and tracking script
 
• Ensure the page that includes the booking form widget also includes the Google Global site tag (gtag.js)
• Add the following script to the same page within the section:
To set up a goal on Google Analytics 4 (GA4) using the provided script, follow these step-by-step instructions:
 
Step 1: Google site tag and tracking script
 
• Ensure the page that includes the booking form widget also includes the Google Global site tag (gtag.js)
• Add the following script to the same page within the section:
				
					 <script>function bookalet_bookingMade(data) {
gtag('event', 'Booking Made', {
'event_category': 'Bookalet',
'value': data['total']
});
}</script>
				
			
Step 2: Access the GA4 Admin Interface
 
• Open the Google Analytics 4 admin interface by visiting https://analytics.google.com/ and signing in with your Google account.
• Select the appropriate GA4 property where you want to set up the goal.
 
Step 3: Create a Custom Event
 
• In the GA4 admin interface, click on “Admin (bottom left od the screen)” in the left navigation menu.
• Navigate to Data Display and click  “Events.”
• Click on the blue button “Create Event.”
• Enter the event name as “booking_made”
• Select the toggle (Mark as key event)
• Select counting method as (Once per event)
• Choose create without code
• Choose a data stream, this will usually be your GA4 property or (website)
• Click on “View more options.”
 
Step 4: Add Event Parameters
 
• Enter the event name as “booking_made”
• In the matching conditions, fill in the details as shown below: 
• Click Save
Configuration GA4 screenshot
 
Step 6: Verify the tracking is working correctly
 
• To verify that the event is tracking correctly, you can simulate a booking event using the script provided or wait for actual events to occur.
 
That’s it! You have successfully set up a goal on GA4 using the provided script. Make sure to implement the script on your website or app to trigger the “booking_made” event with the necessary parameters for accurate tracking.