Google Analytics & GTM

Google Analytics & GTM

Integrate your OptiMonk account with Google Analytics or Tag Manager to gain more insights.

Google Analytics & GTM is OptiMonk's integration layer that connects your OptiMonk campaigns to Google Analytics 4 — allowing you to track campaign events, measure revenue impact, build audience segments from campaign interactions, and compare OptiMonk campaign performance against your broader site metrics in the same analytics environment you already use. OptiMonk automatically pushes a structured event called optimonk_campaign_event to Google Analytics for every campaign interaction — shown (impression), filled (conversion), close(x) (dismissed via the X button), and no (rejected via a "no thanks" link) — along with event properties for campaign name, campaign ID, variant name, and action type. The integration works two ways depending on how your GA4 is installed: if Google Analytics is installed directly on your site, OptiMonk auto-detects the GA code and forwards events without any additional configuration. If GA4 is installed via Google Tag Manager, a short setup is required in GTM — either by importing a pre-built OptiMonk JSON container file, or by manually creating a GA4 event tag triggered by the optimonk_campaign_event data layer push. After connecting, three Custom Definitions are set up in GA4 (campaign name, action, category), and two audiences — OptiMonk Shown and OptiMonk Filled — are created to enable side-by-side comparisons of visitors who saw or converted through a campaign versus the full site population.

Key benefits

  • See OptiMonk campaign data inside your existing GA4 reporting environment. Rather than switching between OptiMonk's dashboard and GA4 to understand campaign impact, the integration brings OptiMonk events directly into GA4 as first-class event data. Campaign names, variants, and actions appear as dimensions in your existing reports — letting you analyze OptiMonk campaign behavior alongside traffic source, device type, landing page, and any other GA4 dimension you already track.
  • Build audiences from campaign interactions for advanced segmentation and retargeting. The OptiMonk Shown and OptiMonk Filled audiences in GA4 define two high-signal segments: visitors who have been exposed to a campaign, and visitors who have converted through one. These GA4 audiences can be used to compare revenue and session metrics between exposed and unexposed visitors, to create retargeting lists in Google Ads, or to build conditional triggers for additional campaigns — all driven by actual campaign interaction data rather than approximations.
  • Revenue attribution for non-Shopify stores through GA4 purchase events. For stores on platforms other than Shopify — or Shopify stores where OptiMonk is installed via GTM — GA4 serves as the revenue data source for OptiMonk's Campaign Analytics dashboard. When your store sends standard GA4 purchase events, OptiMonk can attribute orders and revenue to campaigns using GA4 as the data bridge, making full revenue attribution available regardless of your ecommerce platform.

How it works

Step 1
Check or configure the connection between OptiMonk and GA4

If GA4 is installed directly on your site (not via GTM), OptiMonk automatically detects it. Verify the connection in OptiMonk Settings → Domains — the Google Analytics toggle should show as active for your domain. If GA4 is installed via GTM, download OptiMonk's pre-built optimonk-ga4.json container file and import it into GTM via Admin → Import Container. Select your existing workspace and merge (not overwrite), then open the imported "OptiMonk Event Reporting GA4" tag, enter your GA4 Measurement ID (found in GA4 → Admin → Data Streams), save, and publish the GTM container.

Step 2
Set up Custom Definitions in GA4

In Google Analytics 4, navigate to Settings → Custom definitions and create three custom event-scoped dimensions: OptiMonk Campaign Action (om_campaign_action), OptiMonk Campaign Category (om_campaign_category), and OptiMonk Campaign Name (om_campaign_name). After saving, wait up to 24 hours — GA4 custom definitions are not real-time and require processing time before they become available in reports and audience builders.

Step 3
Create the OptiMonk Shown and OptiMonk Filled audiences

In GA4, go to Settings → Audiences → New audience. In the Include Users dropdown, select the optimonk_campaign_event event. Set the parameter to OptiMonk Campaign Action with the condition "contains" and the value "shown" for the first audience, and repeat with "filled" for the second. Save both audiences. After 24 hours, these audiences are available in any GA4 report under Add Comparison — allowing you to view any metric broken down by visitors who saw or converted through an OptiMonk campaign versus the full site population.

Frequently asked questions

What is the Google Analytics & GTM integration in OptiMonk?+

The Google Analytics & GTM integration connects OptiMonk campaign events to Google Analytics 4, enabling campaign performance tracking inside GA4. OptiMonk automatically pushes a structured optimonk_campaign_event to GA4 for every campaign shown, filled, closed, or rejected interaction — with properties for campaign name, ID, variant name, and action. If GA4 is installed directly on the site, the connection is automatic. If GA4 is installed via GTM, a short GTM configuration is required to route the events correctly.

What events does OptiMonk send to Google Analytics?+

OptiMonk sends a single event type — optimonk_campaign_event — with four possible action values: shown (the campaign was displayed to the visitor), filled (the visitor completed the campaign's conversion goal), close(x) (the visitor dismissed the campaign using the X button), and no (the visitor explicitly rejected the offer via a "no thanks" link). Each event also carries the campaign name, campaign ID, and variant name as properties, allowing full campaign-level and variant-level filtering in GA4.

Do I need GTM to integrate OptiMonk with GA4?+

No. If your GA4 tracking code is installed directly on your website — not via GTM — OptiMonk detects it automatically and forwards campaign events without any additional setup. The GTM configuration is only required when GA4 is deployed through Google Tag Manager, because in that case OptiMonk cannot detect GA4 directly and must push events through GTM's data layer to reach GA4. You can verify whether OptiMonk has detected GA4 in OptiMonk Settings → Domains.

Why do I need to wait 24 hours after setting up Custom Definitions in GA4?+

GA4 custom definitions — the dimensions you create to surface OptiMonk event properties in reports — are not processed in real time. After you create a custom dimension in GA4, it can take up to 24 hours before GA4 recognizes the parameter in incoming events and before the dimension becomes available in reports, audience builders, and the Add Comparison tool. During this window, the optimonk_campaign_event is still being received by GA4 — it will retroactively appear once the custom definition is processed.

Can I use the OptiMonk audiences in Google Ads for retargeting?+

Yes. GA4 audiences — including the OptiMonk Shown and OptiMonk Filled audiences you create — can be shared with Google Ads by linking your GA4 property to your Google Ads account. Once linked, these audiences appear in Google Ads as remarketing lists, allowing you to run retargeting campaigns specifically at visitors who were shown or who converted through an OptiMonk campaign. This enables a cross-channel loop: OptiMonk captures on-site, GA4 segments the audience, and Google Ads retargets the unexported segment post-session.

Ready to try it?

Try OptiMonk for free

Launch your first campaign, learn what works, then scale what converts.

performance