Integration with Google Analytics 4

Good afternoon.

Not so long ago, Google announced that the Universal Analytics platform will stop processing new data in standard resources from July 1, 2023 and that it is necessary to transfer all its resources to Google Analytics 4.

In this regard, we have also added the ability to configure the integration of web forms with GA4. To do this, we have created a separate integration module “Google Analytics 4”, leaving Universal Analytics support in form settings.

If you have already switched from Universal Analytics to Google Analytics 4, then in order to configure the integration, you need to go to the Modules section and find our new module there:

Integration with GA4 1

Hover the cursor over it and click on the “Add” button, after which the basic settings of the GA4 integration module will open in front of you:

Integration with GA4 2

Here you need to enter the ID of the data stream, the name of the event and, if necessary, you can add event parameters by clicking on the appropriate button.

The stream ID can be found out if GA switch to the “Administrator” mode and open the “Data Streams” section:

Integration with GA4 3

Here you need to create a new data stream, if you don't have one yet, or select an existing one by clicking on its name:

In the window that opens, you will find the ID of the data stream:

Integration with GA4 5

In Universal Analytics, sending an event looked like this:

ga('send', 'event', [eventCategory], [eventAction], [eventLabel], [eventValue], [nonInteraction]);

or

gtag('event', '<eventAction>', {
  'event_category': <eventCategory>,
  'event_label': <eventLabel>,
  'value': <eventValue>,
  'non_interaction': true
});

where:

  • EventCategory (Event category, required parameter) – a common name for a group of objects to be tracked. For example: button, form, link, etc.;
  • eventAction (Event action, required parameter) – defines the type of user interaction with the site object. For example: click, view, download, etc.;
  • eventLabel (Event label, optional parameter, but recommended) is the category (group) to which the monitored object belongs. For example: "navigation menu";
  • eventValue (Event value, optional parameter) is an integer value that can be used to provide data about the user's event, for example: "time, transaction amount, passing of the nth level in the game, etc."
  • nonInteraction / non_interaction (without interaction, optional parameter) - can take the value true or false. If true is passed, then this event will not affect the parameters and indicators in Google Analytics reports in any way, including the bounce rate.

In Universal Analytics, events are configured at the presentation level, in the Goals section:

Integration with GA4 6

In GA4, there are no parameters described above (Category, Action, Label, Value), and the construction itself has the form:

gtag('event', '<event_name>', {
  '<parameter_1_name>': <parameter_1_value>,
  '<parameter_2_name>': <parameter_2_value>,
  '<parameter_3_name>': <parameter_3_value>
});

<eventAction> in Universal Analytics is mapped to <event_name> (event name) in Google Analytics 4, and <EventCategory>, <eventLabel>, <eventValue> and their values are passed as event parameters as a key pair:meaning. You configure the list of parameters yourself and can transmit various data with which you can find out additional information about the transmitted events, for example, the name of the form or the address of the page.

Event Name (Event Name) is a key element when creating an event.

In Google Analytics 4, there are Automatically registered events that already have their own event_name, as well as events of the Improved Statistics type, which also have event names predefined by the system. In addition, there are also Recommended events. To view the names of events for each of the types, follow the links:

If you use your own Event Name, then such an event is considered special.

After you fill in the event name and its parameters, you need to check the correctness of data transmission in GA4. There are different ways to do this:

  • Check the event in the report “In real time”
  • Using DebugView in the “Configuration” section and the browser extension Google Analytics Debugger

Measurement Protocol

If necessary, you can configure sending events to GA4 via Measurement Protocol. To do this, open the “Measurement Protocol” section in the module settings:

Integration with GA4 7

Here you need to activate the switch “Use Measurement Protocol to send events” and enter the “API secret key for Measurement Protocol" below.

The API secret key can be found in the GA4 stream settings by clicking on the corresponding section:

Integration with GA4 8

After that, the following window will open in front of you:

Integration with GA4 9

Here you need to click on the “Create” button, then come up with a name and create a Secret API key, the value of which you need to enter in the module settings:

By enabling the sending of events via the Measurement Protocol, the event will be sent to GA4 not in the user's browser, but in the background from the server, when creating an application.

If you enable the switch “Send events to the validation server”, the event will be sent to the GA4 validation test server, where you can check the correctness of the event generation. If something is configured incorrectly, then you can find exactly what the error is in the logs.

All server responses when sending events via the Measurement Protocol will be saved in the Logs section, and the “Actions of integration modules” limit will also be deducted.

That's all for today. Have a good day.

Comments
Ready-made templates of web forms
Basic

Make an appointment to see a dentist

Make an online appointment with the dentist Details
Basic

Sign up for a car service

Template of online time reservation for car service services Details
Gold

Test for knowledge of world capitals

Take a knowledge test of world capitals. Find out your level Details
Gold

Office rent

Get a selection of optimal office rental offers Details

Order turnkey form development

No time to figure out all the settings yourself? No problem!
Order web form development from us