How to instrument Web events as App + Web events

This article explains how you can implement Web property events as App + Web events.

To populate Web and App + Web properties at the same time, include both the tags for your Web property and your App + Web property.

The basic page tag is required in order for event tags to function.

Web vs App + Web events

In Web properties, an event is a special kind of hit (distinct from, for example, a pageview) that has a Category, Action, and Label. By contrast, in App + Web properties, everything (including a pageview) is an event. App + Web events have no notion of Category, Action, and Label and, unlike in Web properties, App + Web reports do not display Category, Action, and Label. Therefore, it’s better to rethink your data collection in terms of the App + Web model rather than port your existing event structure to App + Web.

App + Web events can be:

Finding an equivalent App + Web event

If you want to translate a Web event into App + Web:

  1. First, look for a matching automatically-collected event. If you find a matching event, you should not recreate a new event. If no matching automatically-collected event exists, proceed to step 2.
  2. Look for matching Enhanced Measurement event. If you find a matching event, you should not recreate a new event.
  3. Look for a matching recommended event. Implement your tagging to trigger the recommended event.
  4. Finally, if you cannot find a suitable equivalent event, create your own custom event.

Example: Enhanced Measurement event

If you use a Web event to measure outbound clicks, you would not create a custom event because this behavior is already available as an Enhanced Measurement event. Similarly, if you use a Web event to measure file downloads, you would use the “File downloads (file_download)” Enhanced Measurement event instead.

You may find an Enhanced Measurement event that is equivalent to your Web event, but that doesn’t support all the parameters you need. For example, let’s say that you want to use the file_download event, but need to add a “file size” parameter. To do this, disable “File downloads” in Enhanced Measurement. You are then free to send the file_download event with your own parameters.

Example: Web event with no App + Web equivalent

Imagine that you send the following event in analytics.js:

ga('send', 'event', 'myCustomEvent', 'myEventAction1', 'myEventLabel1');

or, using a slightly different syntax:

ga('send', {
 hitType: 'event',
 eventCategory: 'myCustomEvent',
 eventAction: 'myEventAction1',
 eventLabel: 'myEventLabel1'
});

Since myCustomEvent does not correspond to any automatic, Enhanced Measurement or recommended events, you would trigger it as follows in gtag.js:

gtag('event', 'myCustomEvent', {
  "TheEventAction": "myEventAction1",
  "TheEventLabel" : "myEventLabel1"
});

TheEventAction and TheEventLabel are custom event parameters. You’ll need to register them in order to see them reflected in your event reports.

If you currently use gtag.js

If you currently tag for a Web property using gtag.js and trigger an event as shown in the code sample above, the event will be automatically be sent to your App+Web property as well, assuming that (1) you have added your App + Web measurement ID to the basic gtag.js snippet and (2) the event doesn't have an explicit "send_to" parameter assigned.

You should review all of the event code on the page to ensure that you indeed want to send all the gtag.js events to the all the gtag.js containers on the page. If so, you can leave these events alone. Otherwise, add a "send_to" parameter to control which property or product (e.g. Google Ads) the event should be sent to.

If you use Google Tag Manager

To do the same in Google Tag Manager, you will create an App + Web Event tag:

  1. Click Tags > New.
  2. Click Tag Configuration and select Google Analytics: App + Web Event.
  3. For Configuration Tag, select your App + Web Configuration tag from the menu.
  4. For Event Name, enter myCustomEvent.
  5. Expand the Event Parameters section and add two rows with the following Parameter Name and Value entries:

    Parameter Name Value
    TheEventAction myEventAction1
    TheEventLabel myEventLabel1
  6. Click Triggering and select an appropriate event that will fire the tag.

  7. Save the tag with an appropriate name (e.g. App + Web event – click – add to cart), and publish your container.

Comparison of Web vs App + Web reporting

In your Web property, myCustomEvent will be reported in the Behavior > Events > Top Events report. The report breaks out your Web events by Category and Action.

View of top events showing custom event categories and actions

In your App + Web property, myCustomEvent is reported alongside all other events.

Here is myCustomEvent as reported in the Realtime report:

Results of realtime report showing myCustomEvent and myEventAction1 and myEventAction2 in results

Here is myCustomEvent as reported in the Behavior report.

View of behavior report shoiwng myCustomEvent listed