Skip to main content

Setting up Google Analytics 4

Kameleoon's latest Google Analytics 4 (GA4) integration is a powerful end-to-end solution tracks events and aligns with Google's recommendations for tracking experiments. This enhanced integration now automatically creates GA4 audiences whenever an experiment is launched, eliminating manual setup and streamlining audience management.

By adhering to Google's best practices, Kameleoon ensures that the tracking of experiments and personalizations is efficient and accurate, providing reliable data for data-driven decision-making. When an experiment is stopped, Kameleoon takes care of the entire process, neatly archiving the corresponding GA4 audience. This seamless integration simplifies your workflow, allowing you to focus on insights and outcomes, rather than managing technical details.

If you want to use Google Analytics 4 Audiences in Kameleoon, refer to this article.

Key benefits

  • Precise behavior insights: The integration captures specific events for visitors targeted by experiments or personalizations. This detailed tracking provides a clearer understanding of how different variations influence user actions. For instance, you can see which variation leads to more clicks, conversions, or other desired outcomes, helping you identify what works best.
  • Effortless audience creation: With automatic audience creation, the integration takes the hassle out of audience segmentation. When an experiment launches, relevant audiences are generated instantly, meaning you can focus on analyzing and acting upon data rather than manually setting up audiences.
  • Segmented variation analysis: Creating an audience per variation is incredibly useful, allowing you to dissect each experiment's impact on distinct audience segments. This level of granularity helps you understand which campaign performs better and which specific elements resonate with certain segments.
  • Real-time decision-making: The integration provides data in real time. With these up-to-date insights, you can swiftly adjust strategies if a variation isn't performing as expected or allocate resources to capitalize on successful variations.

Use cases

Personalized product recommendations for e-commerce

Use case: Suppose an e-commerce website wants to enhance its product recommendation strategy. By integrating GA4 with Kameleoon, they can create an experiment with a variation for each product category and target visitors based on their browsing history. When a visitor interacts with the experiment, an event is sent to GA4. The integration then automatically creates an audience for that specific product category. This audience data provides insights into which product categories resonate most with their audience and helps tailor future campaigns.

Benefit: The e-commerce website gains a comprehensive view of visitor preferences and can make real-time adjustments to recommendations. This data-driven approach can lead to higher conversion rates and increased customer satisfaction.

Optimizing content engagement for publishers

Use case: A content-focused website aims to improve reader engagement. With the integration, they create a Kameleoon experiment for different content types (articles, videos, infographics) and variations (layout A, layout B). Events are triggered when visitors interact with specific content. The automatic audience creation feature generates audiences for each content type and variation. By analyzing engagement metrics across these audiences, the website can discern the most effective content format and layouts.

Benefit: The website can optimize its content strategy, creating more of what resonates with their audience, which can lead to longer on-site durations, increased page views, and increased reader satisfaction.

Form conversion enhancement for SaaS companies

Use case: A SaaS company wants to improve its lead generation form conversions. By integrating GA4, they set up experiments for different stages of the form process (started, completed) and form variations (short form, long form). Events are triggered as users interact with form elements. The integration's automated audience creation establishes audiences for each stage and form version. Analyzing these audiences provides insights into where users drop off and which form layout is most effective.

Benefit: The SaaS company can refine its forms based on real-time data, reducing friction and improving conversion rates, which can result in more qualified leads and increased revenue.

Considerations

Keep these things in mind when using this integration:

  • Integration selection: On the Integrations page, you'll find two GA4 integrations listed: Google Analytics 4 and Google Analytics 4 (recommended by Google). Ensure you choose Google Analytics 4 (recommended by Google) for the desired features.
  • Audience management: Keep track of the number of audiences you're creating to avoid hitting the audience limit for your GA4 plan. Archive audiences that are no longer relevant to make space for new ones. Note that there is a 48-hour waiting period before you can reuse an audience name.
  • Experiment launch method: When planning experiments, be aware that audiences will be automatically created for each variation, regardless of whether the experiment is launched from the Code editor, Graphic editor, or as a Personalization.
  • Personalization campaigns: Understand that audience creation won't happen when using the integration in a Personalization campaign. This limitation affects the automated audience setup described for experiments.
  • Google account permissions: Ensure that the Google account granting permissions to Kameleoon has sufficient rights to create and archive audiences in your GA4 properties. This step is crucial for the integration's proper functioning.
  • Account updates: If you must modify the rights granted to Kameleoon, keep in mind that updating permissions might require restarting the OAuth process. Plan for any potential disruptions during this process.

Limitations

Relevant limits for this integration are the following:

  • Archived audiences: Once an audience is archived, it cannot be accessed or restored. This limitation means you should carefully decide which audiences to archive, as you can't retrieve or work with them later.
  • Automatic audience creation: Automated audience creation is currently available for web experience and personalization.
  • Audience number limit: The number of audiences you can create depends on your GA4 plan. If you've reached your plan's limit, you may not be able to create new audiences, requiring management and potential archiving of older audiences.
  • Google account rights: The integration relies on Google OAuth, so ensure that the Google account granting permissions to Kameleoon has the required rights. If these rights must be updated, restarting the OAuth process might be necessary.

Prerequisites

To configure this integration, you should have completed the following:

Activate the integration on your projects

  1. Log in to your Kameleoon account.
  2. Click Admin > Integrations > Google Analytics 4 (recommended by Google) > Install the tool.
  3. Select the projects on which you want to use the integration.
  4. Click Tool settings.
  5. Under Method, select Google tag (gtag.js) (this is selected by defualt)

IF you want to provide a specific Measurement ID:

  1. Click Send events through Measurement ID.
  2. Enter the Measurement ID.

Although it is optional, we highly recommend providing the Measurement ID to ensure events are sent to the correct web data stream.

IF you want to generate a GA4 Audience upon experiment launch:

  1. Click Continue with Google.
  2. Log in to your Google account if prompted.
  3. Provide your project's Property ID.

Once you are satisfied with your selections, click Validate.

note

If you need to change the behavior of our native bridge, you can create a custom analytics bridge and use the GA4 sample code on our Github repository.

Associate the GA4 integration with a Kameleoon campaign

With the integration successfully activated, you can now utilize it within all campaigns associated with projects where the integration has been enabled.

From the Code Editor

  1. Click Finalize > Tracking and goals > Other tracking tools.
  2. Select Google Analytics 4 (recommended by Google).
  3. Click Validate.

Google Analytics 4 will be mentioned in the summary before going live. Kameleoon will automatically transmit the data to Google Analytics 4 and you can view your results directly in the tool if you have successfully configured the Create audience option during the setup.

From the Graphic Editor

caution

Audiences will only be automatically created for each variation if the experiment is launched from the Code Editor. For experiments launched from the Graphic Editor, automatic audience creation won't occur.

  1. Click Finalize > Integrations.
  2. Select Google Analytics 4 (recommended by Google) as your tracking tool

Google Analytics 4 will be mentioned in the summary before going live. Kameleoon will automatically transmit the data to Google Analytics 4 and you can view your results directly in the tool.

From the Personalization Builder

caution

Audience creation won't happen when using the integration on a Personalization campaign. Audiences will be automatically generated only when the integration is set up from the Code Editor during experiment launch.

You can select GA4 as a reporting tool for a personalization the same way you would in an A/B test.

From the Results page

caution

Automatic audience creation won't happen when integrating from the Results page. Audiences will be automatically generated only when the integration is set up from the Code Editor.

Once Google Analytics 4 is set as a reporting tool for an experiment, you can select (or unselect) it via the Kameleoon results page. To do this:

  1. Click Reporting Tools > Edit.
  2. Select or unselect Google Analytics 4 (recommended by Google).
  3. Click Validate.

On a feature flag

Learn how to manage third-party analytics integrations

Stopping the Experiment and Archiving Audiences

When it comes to concluding an experiment in your Kameleoon account, it's essential to be aware of how the GA4 integration manages audiences. When you stop an experiment, the integration archives audiences created during the experiment's lifecycle.

Under specific conditions, the audiences that have been automatically generated by the GA4 integration will be archived. This automatic archival process comes into effect only when you stop an experiment from the Code Editor, ensuring audiences associated with variations within the experiment are preserved and cataloged for reference.

However, it's important to note that this automated archival doesn't apply to experiments that are halted from the Graphic Editor or to campaigns involving Personalizations. In these cases, audiences will not be archived automatically upon experiment termination.

Server-side tagging for GA4

If you're utilizing GA4 with server-side tagging, it's essential to ensure seamless integration and accurate data tracking. Following the instructions provided on this page is recommended.

These guidelines offer comprehensive insights and best practices endorsed by Google for integrating Kameleoon with GA4 through Google Tag Manager (GTM).

How it works

When you configure the integration in Kameleoon, you choose the Google Analytics 4 property you want to associate with the project’s experiment and consent to the integration.

When the experiment begins, Kameleoon creates an audience for each experiment variant. Then, the Experience-variant ID dimension surfaces the data associated with each user in an experience variant.

Before an experiment ends, you can analyze the results of the experiment using the Experience-variant ID dimension. When the experiment ends, Kameleoon deletes each audience so you don't exceed the audience limit. However, you can still access the experiment variant data in Explore and BigQuery.

Sending events

This integration will send events to Google Analytics 4 using the Google tag (gtag.js) installed on your website.

As recommended by Google, the event is called experience_impression and contains a parameter called exp_variant_string.

gtag('event', 'experience\_impression', {
exp\_variant\_string: "KAM-F2948574-3495F49"
});

To avoid duplication across experiments and other partners, we use the format KAM-YYYYYYYYY-ZZZZZZZZ for the exp_variant_string parameter value, where:

  • KAM is the ID for Kameleoon
  • YYYYYYYYY is the experiment's ID
  • ZZZZZZZZ is the variation's ID

Creating Audiences

Audiences let you group users who have been added to a variant based on the exp_variant_string parameter. By using this parameter as the membership condition for an audience, users are added to the appropriate audience based on the variant they have been added to.

These Audiences are automatically generated when the experiment is launched from the Code Editor.

An automatically generated Audience will be named according to the following format:

"Audience KAM - experiment YYYYYYYYY variant ZZZZZZZZ"

where:

  • KAM is the ID for Kameleoon
  • YYYYYYYYY is the experiment's ID
  • ZZZZZZZZ is the variation's ID

Archiving Audiences

When managing your experiments and leveraging the GA4 integration in Kameleoon, it's important to note a key feature related to audience management: when an experiment is stopped, it will automatically archive GA4 Audiences that were automatically generated by the integration.

This archiving process occurs exclusively when an experiment is stopped from the Code Editor. Audiences created for variations within the experiment will be seamlessly archived, ensuring that historical data is retained for analysis and comparison.

It's essential to understand that this automatic archival process doesn't apply to experiments stopped from the Graphic Editor or to Personalization campaigns. If you choose to halt an experiment from the Code Editor, rest assured that the associated audiences will be archived, providing you with a clear record of the audience's engagement during the experiment's active phase.

Beginner's Guide to Google Analytics 4

If you're new to Google Analytics 4 and looking for a comprehensive guide to get started, we recommend the following resource:

Ultimate Beginner's Guide to Google Analytics 4

This guide provides step-by-step instructions and valuable insights for beginners who want to harness the power of Google Analytics 4.

Frequently Asked Questions

How do I make sure events are correctly sent to GA4?

When a visitor performs the action that triggers the custom event, the event will appear in the Realtime report and DebugView. You can also click the name of an event in the Realtime report and DebugView to see its event parameters.

What is the GA4 Integration by Kameleoon?

The GA4 Integration by Kameleoon lets you connect your Kameleoon experiments and personalizations with Google Analytics 4 (GA4). It enables the tracking of targeted visitor events, automatic audience creation, and deeper insights into experiment performance.

What's the significance of automatic audience creation?

Automatic audience creation generates GA4 audiences for each variation in your experiments. This helps you understand how different variations impact visitor behavior. However, remember that this feature works only if the experiment is launched from the Code Editor.

Can I use the integration's automatic audience creation feature with Personalization campaigns?

No, the integration's automatic audience creation feature is not available for Personalization campaigns. It's currently limited to experiments launched from the Code Editor.

"Google Analytics 4 (recommended by Google)" is the integration you should select for enhanced functionality. Choose this option to ensure proper event tracking, audience creation, and integration features. "Google Analytics 4" is deprecated.

Can I manage my audiences after they are archived?

Once audiences are archived, they cannot be restored or accessed. It's crucial to carefully manage your audiences and archive those that are no longer relevant to free up space for new ones.

What happens if I reach the audience limit?

GA4 Properties have different audience limits based on the plan: standard or Analytics 360. If you reach your plan's limit, consider archiving older audiences to create new ones. Note that it may take up to 48 hours before you can reuse an archived audience name.

What rights does my Google account need for the integration?

Your Google account needs sufficient rights to create and archive audiences on your GA4 Properties. Ensure the account you grant access to meets these requirements.

Can I update the rights for my Google account after integration setup?

Yes, you can update rights, but you might need to start the OAuth process again. Plan for potential disruptions when making these updates.

Where can I get support or assistance for the integration?

If you need help or have further questions, you can reach out to Kameleoon's support or consult our documentation for guidance on using and troubleshooting the GA4 integration.

What is a Measurement ID?

A Measurement ID is an identifier (for example, G-12345) for a web data stream. You can use the Measurement ID to send data to a specific web data stream.

Where can I find my Measurement ID?

To find your Measurement ID, please follow the instructions described in Google’s documentation.

What is a Property ID?

A Property ID is a unique identifier assigned to each property in your Google Analytics 4 account. It helps distinguish and organize data collected from different sources, such as websites or apps. Each Property ID corresponds to a specific digital asset you're tracking, enabling GA4 to accurately aggregate and analyze data for that asset.

Where can I find my Property ID?

To find your Property ID, please follow the instructions described in Google’s documentation.

How many Audiences are created per experiment?

Audiences are automatically created per variation for experiments launched from the Code Editor. Each variation in an experiment will have a corresponding audience. However, remember that this automatic audience creation won't occur if the experiment is launched from the Graphic Editor or for Personalization campaigns. This setup provides granular insights into the performance of each variation by segmenting your audience based on their interaction with the experiment.

What happens if multiple Measurement IDs are present on the page and the Measurement ID field is left unspecified?

When sending an event, Google tag will always use the current local target (identified by the Measurement ID), configured using the config command, set using the set command, or passed using the event command.

To ensure accurate and reliable tracking, it's crucial to specify the correct Measurement ID in the designated field. This step eliminates any uncertainty and guarantees that events are accurately sent to the intended web data stream for precise analysis and insights.

References

Setup using the Google tag (gtag.js):

Measurement ID:

See your events in Analytics:

(GA4) Integrating with a third-party experiment tool:

Create an experiment integration with Google Analytics: