Google Analytics App + Web Tracking

2 September 2020

Share:

share_icon_fb share_icon_ln
post_image

Not so long ago Google released a new feature – ‘App + Web Property’ that allows tracking data from both mobile apps and websites. In this blog post, we will learn what features ‘App + Web Property’ offers.

Content:

  1. Enhanced Measurement (Web)
  2. Event Measurement
    1. Automatically collected events (App)
    2. Recommended events (App)
    3. Custom events (App)
    4. Conversions (App)
    5. User Properties (App)
  3. eCommerce Measurement (App)
    1. Android Purchase code snippet
    2. iOS Purchase code snippet
  4. Summary

Unlike other Google Analytics Properties, data in ‘App + Web Property’ is divided into so-called ‘Data Streams’. For example, if you want to track combined data from a website, an iOS app and an Android app, you would need to create 3 data streams for the website as well as iOS and Android apps.

1. Enhanced Measurement (Web)

For the website data stream, Google provides the ‘Enhanced Measurement’ feature, which allows you to track page views; scrolls; outbound clicks; site search; video engagement; and file downloads automatically. All you need to do is enable it:

We won’t dive into great detail, but here are a few quick words on each tracking item:
Page views – automatically enabled via Enhanced Measurement. Additionally, page views can be tracked based on ‘history-based’ events.
Scrolls – pretty straightforward – the event is fired when a page is scrolled to the bottom. No need for additional configuration.
Outbound clicks – relevant for all businesses to gain insights on which external domains or links take the user off your site.
Site Search – enable this feature if you have site search functionality available on your website. When a user makes a search, a special parameter is added to the URL – you should specify this parameter in the additional configuration in order to make the site search event fired.
Video engagement – enable to track YouTube videos on your website.
File downloads – the event is fired when a user clicks a link leading to a file (pdf, doc, xls, etc.)

2. Event Measurement

Events are needed to show what actions take place on your app and website, e.g. clicks, form submissions, errors, etc. In the App + Web property a lot of events are tracked automatically (for apps), so there is no need to add any.

Automatically collected events (App)

Once iOS or Android SDK is implemented in your app, some events are tracked automatically such as first_visit, session_start, user_engagement, and page_view. https://support.google.com/analytics/answer/9234069

Recommended events (App)

Depending on your business type/category, App + Web Property offers recommended events. You can send these recommended events along with their prescribed parameters to get maximum benefits.

But what if neither automatically collected events nor recommended events allow you to track required actions? Then, you should use custom events (you can log up to 500 different Analytics event types).

Custom events (App)

To implement a custom event in your app, you should:
[1]: Know exactly under what conditions the event should be fired.
[2]: Think about event taxonomy (event name, parameters).
[3]: Prepare a code snippet for the implementation to send to developers.
For example, you need to track when a user taps a specific CTA button (e.g. ‘Buy Now’) in your app (iOS and Android) on a particular screen (e.g. on the main screen).
Where ‘cta’ is ‘event name’; ‘event_label’ is a custom parameter to track button title (‘Buy Now’) and ‘event_category’ is a custom parameter to track event location (main screen).
The following code snippets can be used:

Swift:

Analytics.logEvent("cta", parameters: [
  "event_label": "buy_now" as NSObject,
  "event_category": "main_screen" as NSObject
])

Java:

Bundle params = new Bundle();
params.putString("event_label", "buy_now");
params.putString("event_category", "main_screen");
mFirebaseAnalytics.logEvent("cta", params);

Notes:
1. Link to the Firebase documentation on how to log events (Android).
2. Link to the Firebase documentation on how to log events (iOS).
3. Always remember to set up parameter reporting in your ‘App + Web’ property. You need to assign parameters to the specific event under the ‘All events’ tab.

Conversions (App)

Conversions show how many conversion events were driven by each aspect of your marketing, along with the value of those events. You can mark any event as a conversion in Google Analytics:

User Properties (App)

User properties are attributes that can be used to describe segments of your user base, such as language preference or geographic location, etc. Analytics automatically logs some of the user properties. Additionally, 25 user properties can be set up per project.
For example, you need to track user status e.g. ‘guest’ or ‘customer’.
Where ‘user_status’ is a user property name; ‘guest’ or ‘customer’ is a user property value.

The following code snippets can be used for ‘guest’:
Swift:

Analytics.setUserProperty("guest", forName: "user_status")

Kotlin:

firebaseAnalytics.setUserProperty("user_status", "guest")

3. eCommerce Measurement (App)

In addition to conversions, it is advantageous to send the whole set of eCommerce events to understand the full conversion cycle. The list of supported events includes events such as view_item, add_to_cart, and begin_checkout that come along with a list of suggested parameters to enable deep and powerful product analysis.

Android Purchase code snippet

Below is the code example to track purchases on an Android app that are not processed in Play Market. Values in brackets are dynamic, so they should be pulled dynamically for each purchase with corresponding values.

// Define product with relevant parameters
Bundle product1 = new Bundle();
product1.putString( Param.ITEM_ID, "");            // ITEM_ID or ITEM_NAME is required
product1.putString( Param.ITEM_NAME, "");         // Item Name
product1.putString( Param.ITEM_CATEGORY, ""); // Item Category
product1.putString( Param.ITEM_VARIANT, "");   // Item Variant
product1.putString( Param.ITEM_BRAND, "");       // Item Brand
product1.putDouble( Param.PRICE, "");            // Item Price
product1.putString( Param.CURRENCY, "" );         // Item-level currency unused today 
product1.putLong( Param.QUANTITY, "");        // Item Quantity

// Prepare ecommerce bundle
ArrayList items = new ArrayList();
items.add(product1);
Bundle ecommerceBundle = new Bundle();
ecommerceBundle.putParcelableArrayList( "items", items );

// Set relevant transaction-level parameters
ecommerceBundle.putString( Param.TRANSACTION_ID, "" );
ecommerceBundle.putString( Param.AFFILIATION, "" );
ecommerceBundle.putDouble( Param.VALUE, "" );        
ecommerceBundle.putDouble( Param.TAX, "" );
ecommerceBundle.putDouble( Param.SHIPPING, "" );
ecommerceBundle.putString( Param.CURRENCY, "" );
ecommerceBundle.putString( Param.COUPON, "" );

// Log purchase event with ecommerce bundle
mFirebaseAnalytics.logEvent( Event.PURCHASE, ecommerceBundle );

Notes:
[1]: Link to the Firebase documentation about ‘ECOMMERCE_PURCHASE’ event.
[2]: Link to the developer documentation about Android ‘ECOMMERCE_PURCHASE’ event.
[3]: The code above should NOT fire repeatedly when a user reloads the confirmation screen or navigates back to the confirmation screen (this will lead to transaction duplication and revenue discrepancy).

iOS Purchase code snippet

Below is the code example to track purchases on an iOS app that are not processed in App Store. Values in brackets are dynamic, so they should be pulled dynamically for each purchase with corresponding values.

// Define products with relevant parameters.
NSDictionary *product1 = @{
   kFIRParameterItemID : @"",            // ITEM_ID or ITEM_NAME is required
   kFIRParameterItemName : @"",         // Item Name
   kFIRParameterItemCategory : @"", // Item Category
   kFIRParameterItemVariant : @"",   // Item Variant
   kFIRParameterItemBrand : @"",       // Item Brand
   kFIRParameterPrice : @,             // Item Price
   kFIRParameterCurrency : @"",         // Item-level currency unused today
   kFIRParameterQuantity : @        // Item Quantity
};

// Prepare ecommerce dictionary.
NSArray *items = @[product1];
NSDictionary *ecommerce = @{
   @"items" : items,
   kFIRParameterItemList : @"",         
   kFIRParameterTransactionID : @"",
   kFIRParameterAffiliation : @"",
   kFIRParameterValue : @,               
   kFIRParameterTax : @,
   kFIRParameterShipping : @,
   kFIRParameterCurrency : @"",
   kFIRParameterCoupon : @""
};

// Log purchase event with ecommerce dictionary.
Analytics.logEvent(AnalyticsEventPurchase, parameters:ecommerce)

Notes:
[1]: Link to the Firebase documentation ‘ECOMMERCE_PURCHASE’ event.
[2]: Link to the developer documentation about iOS ‘ECOMMERCE_PURCHASE’ event.
[3]: The code above should NOT fire repeatedly when a user reloads the confirmation screen or navigates back to the confirmation screen (this will lead to transaction duplication and revenue discrepancy).

Summary

App + Web Property is a great feature with a cross-platform measurement. Now there is no need for additional set-up e.g. outbound link clicks just enable ‘Enhanced Measurement’ feature for the web data stream and that is it. App + Web provides a large list of automatically collected events for apps, however, of course in order to track macro and micro conversions you would need to implement custom tracking (events, user properties for apps). Moreover, App + Web Property provides a great built-in Funnel and Path Analysis Reports that are not available in other Google Analytics Properties. You can learn more about it in our Google Analytics App + Web Property Walkthrough blog post.

Author: Alex Gerad, Senior Data Analytics at Viden

Share:

share_icon_fb share_icon_ln

Related Insights

Google Analytics 4. Implementation Guide for GTM

2 April 2021

Updates of digital tools and services from larger businesses always raise many questions and concerns regarding future functionality. Even product updates of a mid-size company can create quite a bustle if businesses rely on the company service. Thus, it is easy to imagine the anticipation and excitement marketers had while waiting for the Google Analytics 4 release. And now it is there. Announced earlier in 2019, Google Analytics 4 was released in October 2020. You can often find marketers referring to it using the acronym GA4. What does the GA 4 version represent for marketers, and how does one get started with it? This article will briefly walk you through the main steps one needs to know, beginning with GA4.
Learn more

Learn with Google: 5-Step Guide to Make Better Marketing Measurements

23 March 2021

In 2021, when the digital marketing industry is evolving according to customer expectations, privacy becomes a crucial factor for digital marketers. In fact, according to a data security survey conducted by RSA, as many as 78% of respondents said that they valued their data privacy the most. It means that new practices are required for marketing measurements to respect consumers' privacy and improve their journey. Teaming up with Google, we've prepared a Guide with 5 Recommendations that can help your business make marketing measurements in a better and smarter way to ensure a seamless customer experience.
Learn more

How to Expand Your Target Market and Lift The Business with Dashing Growth

23 February 2021

Your business might have a loyal customer base, however, it is always a good idea to look for ways to attract new clients. One of the solutions to tackle that is to extend your target market. How? Let’s dig deeper. The tactic is to understand motivations and triggers that can work for different buyers’ segments and use them for developing persuasive creatives when placing the ads.
Learn more