How to Use Google Analytics App + Web Tracking Feature
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:
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 and iOS and Android apps.
1. Enhanced Measurement (Web)
Google provides the ‘Enhanced Measurement’ feature for the website data stream, automatically tracking page views, scrolls, outbound clicks, site searches, video engagement, and file downloads. All you need to do is enable it:
◆ 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 searches, a special parameter is added to the URL – you should specify this parameter in the additional configuration 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, many events are tracked automatically (for apps), so there is no need to add any.
Automatically Collected Events (App)
Once the iOS or Android SDK is implemented in your app, some events such as first_visit, session_start, user_engagement, and page_view are tracked automatically.
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, use custom events (you can log up to 500 different Analytics event types).
Further reading: Passing Customers Data to Google Analytics from Shopify
Custom Events (App)
To implement a custom event in your app, you should:
- Know exactly under what conditions the event should be fired
- Think about event taxonomy (event name, parameters)
- 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:
- Link to the Firebase documentation on logging events (Android)
- Link the Firebase documentation on log events (iOS)
- Always set up parameter reporting in your ‘App + Web’ property; you must 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 and 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 describe segments of your user base, such as language preference, 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, sending the whole set of eCommerce events is advantageous 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:
- Link to the Firebase documentation about the ‘ECOMMERCE_PURCHASE’ event.
- Link to the developer documentation about Android ‘ECOMMERCE_PURCHASE’ event.
- The code above should not repeatedly fire when a user reloads the confirmation screen or navigates back to the confirmation screen (this will lead to transaction duplication and revenue discrepancy).
Further reading: Google Analytics — eCommerce Overview
iOS Purchase Code Snippet
Below is the code example to track purchases on an iOS app that are not processed in the 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:
- Link to the Firebase documentation ‘ECOMMERCE_PURCHASE’ event.
- Link to the developer documentation about the iOS ‘ECOMMERCE_PURCHASE’ event.
- 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. There is no need for additional set-up, e.g., outbound link clicks. Just enable the ‘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, to track macro and micro conversions, you would need to implement custom tracking (events, user properties for apps). Moreover, App + Web Property provides 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.
Get in touch
Got a question? We'd love to hear from you. Send us a message and we'll respond as soon as possible.
By clicking submit, you agree to our Privacy Policy
Latest Insights
Get the tips from our experts to optimize and scale your campaigns