Skip to main content
All CollectionsViral Loops key Integrations explained
Setting up Google Analytics 4 and Viral Loops (GA4)
Setting up Google Analytics 4 and Viral Loops (GA4)

How to set up your GA4 with your Viral Loops campaign

Thanos avatar
Written by Thanos
Updated over a year ago

1. Understand how Google Analytics 4 is installed

There are two ways one can install Google Analytics 4:

  1. Directly to their website through the GA4 gtag() — most common

  2. Through the Google Tag Manager, which has an installation of its own

Method comparison

The gtag() method is more straightforward and lets you manage all analytics from inside Google Analytics 4. This gtag() is only responsible for analytics.

The Google Tag Manager (GTM) method assumes you have already installed GTM in your website. GTM injects custom code into your website for you. In this case, it will inject the gtag(). This goes beyond analytics and lets you inject scripts from other tools and have more control over what data reaches GA4.

Installation instructions

2. Viral Loops <> GA4 Integration without Google Tag Manager

a) Copy your Google Analytics 4 Measurement ID

Go to your GA4 Property > Admin > Property Settings > Data Collection > Data Streams

b) Activate the Viral Loops integration

Go to your Viral Loops campaign > Edit > Integrations > Google Analytics 4.

Add your measurement ID and enable the integration. Once done, you can go back to the Viral Loops dashboard.

c) Check that Google Analytics 4 receives your campaign’s data

Open the Google Tag Assistant and paste it into your website's URL.
Link to Google Tag Assistant


This will open a new window; do not close any of the two windows.

Go on and participate in your campaign. Then, copy the referral link.

Go back to the Tag Assistant tab and check that the Viral Loops hits have been sent to GA4.

Note: You can also check that you receive the data in the “Realtime” report inside Google Analytics 4.

d) Mark the Viral Loops events as conversions

Go to your GA4 Property > Admin > Property Display > Events

There, locate the Viral Loops events and mark them as conversions.

Data can take up to 24 hours to appear here. Make sure you have selected the right date range on the top right of the screen.

3. Viral Loops <> GA4 Integration through Google Tag Manager

Acknowledgement:

Right now, there is no explicit Google Tag Manager integration in our app. Indeed, there should be a distinct one. However, you can use Viral Loops with Google Tag Manager to send data to GA4 through the Viral Loops GA4 Integration.

Prerequisite:

A basic understanding of how the dataLayer works. Find out more about it here or ask ChatGPT.

a) Activate the Viral Loops Google Analytics 4 integration

Go to your Viral Loops campaign > Edit > Integrations > Google Analytics 4

Skip the measurement ID and enable the integration. Once done, you can go back to the Viral Loops dashboard.

b) Check that the Google Tag Manager receives Viral Loops data

Go to your GTM Account > Workspace > Preview

Fill in the url of the page where you host the Viral Loops form to start the debugger.

Go on and participate to your campaign. Then try to copy the sharing URL.

Go back to the Google Tag Manager debugger window. You should see two Viral Loops API calls for every action you took.

c) Create the Google Tag Manager Triggers

These need to contain the exact names Viral Loops send to the dataLayer.

Example:

d) Create the Google Tag Manager Tags

Here is what an example event should look like:


And... that's all 😎 If you need any further help, please email us at support@viral-loops.com or just send us a message from the support bubble on the right-bottom corner of your account!

Did this answer your question?