Optibase
  • ๐Ÿค”What is Optibase
    • ๐ŸงชWhat is a Test/Variant Group
    • ๐ŸชžWhat is a Variant
    • ๐ŸWhat is a Conversion
    • ๐Ÿง‘What is a Tested User
    • ๐Ÿ What is a Guest User
    • โš™๏ธWhat does the custom script do?
    • ๐Ÿ‘‘Probability to Be Best (P2BB)
  • ๐Ÿ‘ทHow to setup Optibase
    • โœ๏ธAdd the custom script
    • ๐ŸŽฏCreate a Conversion
    • ๐Ÿ”—Connect a Conversion
    • ๐Ÿ–ฅ๏ธServer-side Conversions
    • โš–๏ธCreate a Test/Variant Group
    • ๐Ÿ†ŽCreate an A/B Variant
    • ๐Ÿ”—Connect an A/B Variant
    • ๐Ÿ”€Create a Split Variant
    • ๐Ÿ”’Force Variants
    • ๐Ÿ‘‘Turn off when a winner is found
    • ๐Ÿ”žSet up restrictions
    • โฒ๏ธSchedule a Test
    • ๐Ÿ“จShare test results
    • ๐Ÿ”„Connect Conversions to a Test
    • ๐Ÿ“…Filter test results by a specific time period
  • ๐Ÿช„Optibase Webflow App
    • โœ๏ธAdd the custom script
    • ๐ŸŽฏCreate a Conversion
    • ๐Ÿ”—Connect a Conversion
    • โš–๏ธCreate a Test/Variant Group
    • ๐Ÿ†ŽCreate an A/B Variant
    • ๐Ÿ”—Connect an A/B Variant
    • ๐Ÿ”€Create a Split Variant
    • โ˜‘๏ธTypes of Content You Can Connect
  • ๐Ÿ”—Integrations
    • ๐Ÿ“žActive Variants API
    • โšกTrigger Conversions with GTM
    • ๐Ÿ“ˆGoogle Analytics 4
    • ๐Ÿ‘ทGoogle Analytics 4 with GTM
    • โœ–๏ธMixpanel
    • ๐Ÿฆ”Track conversions in PostHog
  • โ“FAQs
    • Why can you see views in the views tab for pages that don't have a test?
    • Why can't I see detailed metrics like average "Time on Page" and "Scroll Depth"?
    • Why do conversions in the Webflow app appear to disconnect randomly, and are these conversions still
    • Troubleshooting Component Connection Issues in Optibase
    • How Optibase Works with CMS in Webflow
    • Why Your Screen Flickers Before Loading the Right Variants
    • Why variants appear disconnected when inside a component?
    • Localisation Limitations in Webflow with Optibase
    • Why Conversions May Not Be Recording in Optibase
    • Does a URL Split Test Work with UTM Parameters?
    • Using Optibase Across Multiple Websites
    • Why Conversions or Results May Not Be Visible in the Results Tab
    • Can I redirect traffic between two different URLs using Optibase?
    • How do I exclude internal traffic from being counted in Optibase tests?
    • Can I connect multiple conversions to a single test?
    • How does Optibase handle geo-restricted A/B tests?
    • Why are conversion events double counted in my test?
    • How can I transfer ownership of an Optibase workspace?
    • Why do I see flickering between A/B variants?
    • Can I test elements across all pages on my website?
    • Why is a guest user still on a free plan after being invited to a paid workspace?
    • Can I redirect traffic between two different URLs using Optibase?
    • How do I set up a multivariate test in Optibase?
    • How do I exclude internal traffic from being counted in Optibase tests?
    • Why are conversion events double counted in my test?
    • Why is the wrong variant showing when I preview using the variant URL?
    • How can I force a specific variant to display for debugging?
    • How do I check which buttons are connected to a conversion event?
    • Can I run multiple tests on the same page?
    • Is it possible to set traffic allocation dynamically during a test?
    • How can I test different CTAs that exist across 50+ pages?
    • What happens when a test reaches statistical significance?
    • How do I view which conversion event was triggered?
    • Can I filter out specific IPs or users from test results?
    • Can I run tests on a site that uses a custom CMS or codebase?
    • Is Optibase compliant with GDPR?
    • Do I need to connect a conversion event to a test for it to be tracked?
    • How do I test different product pages with different pricing?
    • What if my team member can't access the Business plan features?
    • Can I test hero images with multiple slides in each variant?
    • Why does a variant not show even with 100% traffic assigned?
    • Can I export test results?
    • How do I test a new user journey that starts on different landing pages?
    • How can I preview the test without affecting analytics?
    • How do I know if my test is live?
    • How many users do I need to reach statistical significance?
    • Can I pause a test and restart later?
    • What is the difference between A/B and multivariate testing?
    • Can I run a test with just one variant?
    • Does Optibase support UTM tracking across redirects?
    • What is a 'Tested User' in Optibase?
    • How do I know when to stop a test?
    • Can I use Optibase for content localization testing?
    • Do I need to re-add conversion tracking for each new test?
Powered by GitBook
On this page
  1. Integrations

Google Analytics 4 with GTM

Note: This is only needed if you have GA4 setup through GTM. If you have added the GA4 script tag directly in your HTML, the Optibase events will be sent automatically.

Guide: Setting Up a GTM Trigger for Optibase Variant Shown Event

This guide will walk you through setting up a Google Tag Manager (GTM) trigger that fires when an Optibase variant is shown. Additionally, we will create a tag that sends an event to Google Analytics 4 (GA4).

Step 1: Access GTM and Create a New Trigger

  1. Log in to your GTM account and open the container you want to configure.

  2. Navigate to Triggers in the left-hand menu.

  3. Click on the New button to create a new trigger.

  4. Name your trigger (e.g., "Optibase Variant Shown Trigger").

  5. Choose Trigger Type: Custom Event.

Step 2: Set Up the Custom Event Trigger

  1. In the Trigger Configuration, set the Event Name to a custom name, such as optibase_variant_shown.

  2. Choose This trigger fires on: All Custom Events.

Step 3: Create a Custom HTML Tag to Listen for Optibase Variants

  1. Navigate to Tags in the left-hand menu.

  2. Click on the New button to create a new tag.

  3. Name your tag (e.g., "Optibase Variant Listener").

  4. Choose Tag Type: Custom HTML.

  5. Add the following HTML and JavaScript code to the HTML field:

<script>
  (function() {
    function sendOptibaseEvent(variants) {
      variants.forEach(function(variant) {
        window.dataLayer.push({
          event: 'optibase_variant_shown',
          event_category: 'optibase',
          event_label: variant.userFriendlyTestId + ':' + variant.userFriendlyVariantId,
          shownVariant: variant
        });
      });
    }

    if (window.optibaseAddActiveVariantsListener) {
      window.optibaseAddActiveVariantsListener(sendOptibaseEvent);
    }
  })();
</script>
  1. Set the tag to fire on All Pages.

Step 4: Create Variables to Capture Event Data

  1. Navigate to Variables in the left-hand menu.

  2. Click on the New button to create a new variable.

  3. Name your variable (e.g., "event_category").

  4. Choose Variable Type: Data Layer Variable.

  5. Set the Data Layer Variable Name to event_category.

  6. Repeat steps 2-5 to create another variable for event_label.

Step 5: Create a GA4 Event Tag to Capture the Variant Data

  1. Navigate to Tags in the left-hand menu.

  2. Click on the New button to create a new tag.

  3. Name your tag (e.g., "GA4 Optibase Variant Event").

  4. Choose Tag Type: GA4 Event.

  5. Select your GA4 configuration tag in the Configuration Tag field.

  6. Set the Event Name to optibase_variant_shown.

  7. In the Event Parameters section, add the following parameters:

    • Parameter Name: event_category

      • Value: {{event_category}}

    • Parameter Name: event_label

      • Value: {{event_label}}

  8. Click on Triggering and add the custom event trigger you created in Step 1 (e.g., "Optibase Variant Shown Trigger").

Step 6: Publish Your Changes

  1. Click on the Submit button in the top right corner of the GTM interface.

  2. Follow the prompts to publish your changes.

Final Check

  • Preview your GTM container to ensure that the custom event fires correctly when an Optibase variant is shown.

  • Check GA4 to verify that the events are being recorded as expected.

By following these steps, you will have set up a GTM trigger that listens for Optibase variant events and sends the relevant data to GA4.

PreviousGoogle Analytics 4NextMixpanel

Last updated 10 months ago

๐Ÿ”—
๐Ÿ‘ท