Google Analytics App + Web Tracking

2 September 2020

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

Related Insights

The Manifest Names Viden as Belarus’ Most Recommended Digital Marketing Agency

30 September 2021

We’re absolutely excited to announce that The Manifest officially named Viden as Belarus’ most recommended digital marketing agency for 2021! Our company wouldn’t be where we are on The Manifest without our clients. Thanks to their amazing feedback, we’ve continuously improved our services and solutions.
Learn more

Viden Records a New 5-Star Rated Review on Clutch

28 September 2021

It’s always a pleasure receiving such great reviews from our past and present clients. We always strive to provide exceptional service to our clients and see them achieve their goals.
Learn more

iOS 15 Rolled Out: New Privacy Features, Marketing Impact and Solutions

27 September 2021

With iOS 15, Apple has released new privacy features that have a great impact on email marketing. Take a look at how they will affect your email campaigns and how to adapt to the oncoming changes.
Learn more