How to setup Zaraz Events to GA4 [solved]

Integrating Google Analytics 4 (GA4) with Cloudflare Zaraz can greatly enhance your website’s tracking capabilities, ensuring accurate and comprehensive data collection. This guide will walk you through the steps to send events from your website to GA4 using Zaraz.

Step 1: Send Event to Zaraz

To begin, you’ll need to send events from your website to Zaraz. Here’s an example of how to track a phone click event using jQuery:

// Phone click event
jQuery('.phone').click(function () {
  console.log('Phone click event triggered');
  zaraz.track('phone_click', {
    'event_category': 'contact'
  });
});

Step 2: Create a Trigger in Zaraz

Next, you’ll need to configure a trigger in Zaraz to capture this event.

  1. Navigate to Zaraz – Tools Configuration – Triggers Tab:
    • Go to the Zaraz dashboard.
    • Select “Tools Configuration”.
    • Click on the “Triggers” tab.
  2. Add a New Trigger:
    • Click on “Add Trigger”.
    • Name the trigger phone_click.
    • Set the variable name to phone_click.
    • Match the value to phone_click.

Step 3: Configure Google Analytics 4 in Zaraz

Once your trigger is set up, you need to configure the action to send this event to GA4.

  1. Go to Third-Party Tools – Google Analytics 4 Settings:
    • In the Zaraz dashboard, navigate to “Third-Party Tools”.
    • Select “Google Analytics 4”.
  2. Create a New Action:
    • Click “Create Action”.
    • In the “Firing Triggers” section, select your phone_click trigger.
    • Set the “Action Type” to “Event”.
    • Configure the event parameters as needed (e.g., set the event name and category).

Step 4: Update Zaraz Settings

To ensure compatibility and proper event tracking, update your Zaraz settings as follows:

  1. Navigate to Zaraz – Settings:
    • Go to the Zaraz dashboard.
    • Click on “Settings”.
  2. Enable Necessary Settings:
    • Check “Data layer compatibility mode”.
    • Check “Set Google Consent Mode v2 state”.

Conclusion

By following these steps, you can seamlessly integrate Zaraz with Google Analytics 4, enabling robust event tracking on your website. This setup ensures that events like phone clicks are accurately captured and sent to GA4 for detailed analysis.

For more detailed guidance, refer to the screenshots provided at each step. Implementing these configurations will help you maximize the potential of your website’s analytics capabilities.

Similar Posts