[GA4] Set up analytics for your site and apps
  • 18 Jan 2024
  • 11 Minutes to read
  • Contributors
  • Dark
    Light
  • PDF

[GA4] Set up analytics for your site and apps

  • Dark
    Light
  • PDF

Article summary

This article explains how to set up your site and apps to push events to your Google Analytics 4 (GA4) account. ViewLift will implement the integration of your website and apps with GA4 streams. Once the integration is complete, you will start seeing the standard and custom events in the respective GA4 data streams. 

Prerequisites

- Your GA4 streams are created.

- "GA4 measurement ID" (aka properties) and "API secret key" are created and shared with ViewLIft.

Integration process

  1. Create your GA4 accounts for web, mobile apps, and OTT.
  2. Link your GA4 Measurement ID with Tools Platform. To find a GA4 Measurement ID, from your Google Analytics account, navigate to Admin > Data Streams and copy the data stream to the link.
  3. To link the Measurement ID, from your ViewLift Tools account, navigate to AppCMS > Settings > Analytics section, and add the Measurement ID in the GA4 Tracking ID field for each device platform, then click Save > Publish.


  4. Identify and verify existing custom events and parameters used in Universal Analytics.
  5. Configure the same custom events and parameters directly in the website and apps' code for GA4 events tracking.
    Note
    To improve the performance of our website and apps, we have opted to implement Google Analytics 4 (GA4) events directly into our platform code. This eliminates the need for Google Tag Manager (GTM), which can add latency to page load times.
  6. Configure GA4 data streams.
  7. Activate Google Signals for cross-device tracking.
  8. Register custom parameters for custom events and test GA4 implementation in parallel with Universal Analytics.
  9. Wait for the ViewLift development teams to complete the integration.

GA3 to GA4: Key differences

Google Analytics 4 uses the same event model as Universal Analytics. This means that you can use the same events and event parameters in GA4 as you did in Universal Analytics. Also, in GA4, you can target events to specific pages or screens. This is the same as Universal Analytics.

Even with these similarities, some characteristics are different, as explained below.


GA3 (Universal Analytics)
GA4
Sessions (Hits Vs Events)A session is based on hits.A session is based on events for a given time period. 
GA4 uses shorter session timeouts (5 minutes) than GA3 (30 minutes). This makes sessions more meaningful and accurate to track user journeys.
Active usersUser activity is reported when a user visits a page or performs an action on a page.User activity is reported automatically. This means that GA4 may report higher active user counts than GA3.
ViewsWeb and app tracking was based on views.
GA3 is like a guestbook. Every time someone visits, you will make an entry.
Works on the logic of data stream. Data streaming works by continuously capturing, processing, and delivering data in real-time as it is generated.
GA4 is like a video camera. It records everything that happens on your website or app. You can then go back and watch the video to see what people did.
Event trackingGA3 events have a specific format called the “category-action-label-value” schema. This means that every event must have a category, an action, a label, and a value. For example, an event for a user clicking on a button might have the category “button,” the action “click,” the label “submit,” and the value “1.”No required schema; events can have customizable parameters.

GA4 has four event categories:

  • Automatically collected events: These events are automatically tracked by GA4. They include events like pageviews, app opens, and session starts.
  • Enhancement measurement events: These events are used to enhance the data that GA4 collects. They include events like scroll depth and exit intent.
  • Recommended events: These events are recommended by Google because they can be helpful for tracking user behavior.
  • Custom events: ViewLift-created events.
Ecommerce trackingPowerful ecommerce tracking capabilities.Ecommerce tracking capabilities still in infancy; no enhanced ecommerce tracking available.
Attribution modellingPowerful multi-channel funnels attribution reports.Few attribution modelling capabilities exist.
Custom dimensionsCan set/change scope to 'Hit', 'Session', 'User', or 'Product'.Replaced 'Hit' and 'Session' scopes with 'event' scope; can create custom dimension with 'event' or 'user' scope.
Custom metrics  Can set/change scope to 'Hit' or 'Product'.No scope changes available; custom metric has only 'event' scope.
Engagement metrics  Uses pageviews and bounce rate metrics.    Provides more accurate engagement metrics. 

These metrics include:

  • Engaged sessions: An engaged session is a session in which a user interacts with your website or app for a certain amount of time. The default amount of time is 10 seconds, but you can customize it.
  • Engagement rate: The engagement rate is the percentage of sessions that are engaged sessions.
  • Engaged sessions per user: The engaged sessions per user metric tells you how many engaged sessions each user has on average.
  • Average engagement time: The average engagement time metric tells you how long users spend on your website or app on average.

ViewLift custom events in GA4 (web)

Following are the custom events that are being sent to GA4 for the Web platform.

Description of the metrics

Event Count - number of times an event is triggered. Events can be anything from clicking a button to watching a video. The event count is updated in real time, so you can see how users are interacting with your website and apps as they are using them.

Total users - number of unique users who triggered any event in the specified date range - identified by their unique identifier e.g. cookie, user_id, etc.

Event count per user - the average number of times an event has been triggered per user.

Event nameFired when the user...
epgProgramLands on a fast channel and the EPG loads. 
View PlansLands on the View Plans page. User's device info will also be passed as part of the event.
impressionViews (impressions) received for the View Plans page.
Player BitRate Changed

A change in bitrate occurs. The event also tracks additional information about the user's activity, including the quality of the video being watched and the source from which the video is being watched.

userInputs an email address on a free plan content page and gives opt-in consent for emails.
Carousel

Engages with content in the Carousel tray.

Hidden View Plans mitvplansOpens a refer and earn plan page on MiTV.
data.titleClicks on a recommendation tray.  The name of the recommendation tray is also tracked.
isRecommendationOpens a video page from a recommendation tray.
Selected a reasonSelects a reason from the subscription cancellation reason drop-down, an event is triggered. This event records the reason for cancellation and the user's unique user ID.
Added to WatchlistAdds a video to their watchlist on the web/apps/TV. The video info is captured too.
ec:addImpressionViews a plan page. It tracks when a plan is selected, the currency code, plan product info, and so on.
Recaptcha ActionTracks the score of a user's Recaptcha action, which determines the legitimacy of user actions and potentially takes appropriate actions based on the score.
playVideoClicks on a video, and the event passes the title and unique ID of the video being played.
trackFunnelTriggered to track the purchase journey on View Plans page.
Customer initiated the subscription planEquivalent to check out.
viewplans --> planSelectedSelects a plan from the Plans page.

viewplans --> planSelected --> createAccount

Selects a plan and lands on the Create Account page.

viewplans --> planSelected --> createAccount --> addBilling

Is at the checkout page.

-- viewplans --> planSelected --> createAccount --> addBilling --> ftStart

 ftStart event is a custom event that is used to track the start of a flow in a workflow.
-- viewplans --> planSelected --> createAccount --> addBilling --> ftStart -- eventName = 'Subscription success' -- subscriptionStatus = 'Subscription failed' OR 'Subscription pending' OR 'Subscription success'"

Subscription success - Fired when a user successfully completes a payment for a subscription.
The event will show as 'Subscription failed' OR 'Subscription pending' OR 'Subscription success'.

This event includes the following parameters - 

  • trackEventFunnel  tracks how many users are completing each step in the funnel, and identifies any areas where users are dropping off.
  • trackAdwordsEvent tracks the user's interaction with an ad from Google Ads. This can be used to see how many users click on your ads and to track the effectiveness of your ad campaigns.
  • gtmTagEcommerceEvent tracks an ecommerce purchase using Google Tag Manager. This can be used to track the number of sales you make and to identify which products are most popular.

How to view data for platforms in GA4/Firebase Analytics Dashboard

When you integrate your GA4 datastream with your Firebase database, all your Firebase data is automatically synced with GA4. This means can view the app data under the Firebase section within the GA4 environment. 

You can build a comparison as illustrated here to view metrics for the desired platform, Apple TV in this example. To do this, in your Firebase or GA4 Analytics Dashboard, click Add comparison. In the Build comparison menu on the RHS, click Dimension and select Source (it may be Platform Name / Platform for some GA4 properties) from the Match Type dropdown menu, select exactly matches, and in the Value drop-down, choose a platform, for example, Apple TV.

On Firebase


On GA4

ViewLift/GA4 events for Samsung TV, LG TV, Vizio, Xbox

Event nameThis event is fired when...
Event Parameters
removed_from_queueA video is removed from the queue.eventCategory, platform, appName, appVersion, os_version, screen_resolution, site, userAgent, device_source
  • eventCategory: The category of the event. In this case, it would be "Removed from Queue".
  • platform: The platform on which the event occurred. In this case, it would be "Samsung TV", "LG TV", "Vizio", or "Xbox".
  • appName: The name of the app in which the event occurred.
  • appVersion: The version of the app in which the event occurred.
  • os_version: The operating system version of the device on which the event occurred.
  • screen_resolution: The screen resolution of the device on which the event occurred.
  • site: The website or app on which the event occurred.
  • userAgent: The user agent of the device on which the event occurred.
  • device_source: The source of the device, such as "Google Play" or "App Store".
added_to_queueA video is added to the queue.
  • eventCategory
  • platform
  • appName
  • appVersion
  • os_version
  • screen_resolution
  • site
  • userAgent
  • device_source
added_to_watchlistA video is added to the watchlist.
  • eventCategory
  • platform
  • appName
  • appVersion
  • os_version
  • screen_resolution
  • site
  • userAgent
  • device_source

removed_all_from_watchlistAll videos are removed from the watchlist.
  • eventCategory
  • platform
  • appName
  • appVersion
  • os_version
  • screen_resolution
  • site
  • userAgent
  • device_source

page_viewedA page is viewed.
  • eventCategory
  • platform
  • appName
  • appVersion
  • os_version
  • screen_resolution
  • site
  • userAgent
  • device_source

searchedA search is performed.
  • eventCategory
  • platform
  • appName
  • appVersion
  • os_version
  • screen_resolution
  • site
  • userAgent
  • device_source

ViewLift/GA4 events for ROKU

Event nameThis event is fired when...
Event Parameters
page_viewUser views a screen.
  • page: The name of the screen.
  • title: The title of the screen. 
  • platform: The device model number.
  • os_version: The Roku device OS version.
  • screen_resolution: The screen resolution.
  • screen_depth: The aspect ratio.
  • appName: The app name.
  • appVersion: The app version.
play-videoUser starts playing a video.
  • video_title: The title of the video.
  • platform: The device model number.
  • os_version: The Roku device OS version.
  • screen_resolution: The screen resolution.
  • screen_depth: The aspect ratio.
  • appName: The app name.
  • appVersion: The app version.
add_to_cartUser adds an item to their cart.
  • currency: The currency code.
  • value: The value of the item.
  • items: An array of items that the user added to their cart. Each item object must have the following properties:
  • item_id: The product identifier.
  • item_name: The user-friendly plan name.
  • index: The index of the item in the cart.
  • price: The price of the item.
  • quantity: The quantity of the item.
  • platform: The device model number.
  • os_version: The Roku device OS version.
  • screen_resolution: The screen resolution.
  • screen_depth: The aspect ratio.
  • appName: The app name.
  • appVersion: The app version.
purchaseUser makes a purchase.
  • currency: The currency code.
  • value: The value of the purchase.
  • transaction_id: The purchase id.
  • items: An array of items that the user purchased. Each item object must have the same properties as the items object in the add_to_cart event.
  • platform: The device model number.
  • os_version: The Roku device OS version.
  • screen_resolution: The screen resolution.
  • screen_depth: The aspect ratio.
  • appName: The app name.
  • appVersion: The app version.

ViewLift/GA4 events for iOS, Android, Android TV & Fire TV

Note: 

Purchase events track all purchases made across both web and app platforms. In-app purchase events specifically track purchases made within mobile apps using the app store's payment system (Google Play or Apple App Store).

Event nameThis event is fired when a user...
Parameters
add_to_cart
Adds an item to their cart.
  • ITEM_ID
  • ITEM_NAME
  • CURRENCY
  • VALUE
  • plan_id
  • plan_name
  • purchase_type
begin_checkoutLands on the "Checkout" page.
  • EVENT_NAME: BEGIN_CHECKOUT
screen_view

Views a screen.

  • screen_view
searchPerforms a search.
  • ITEM_CATEGORY, ITEM_NAME
view_itemViews an item.
  • ITEM_CATEGORY
  • ITEM_NAME
tray_eventInteracts with the tray, such as by opening or closing it.
  • page_name
  • tray_name
  • tray_position
  • item_name
  • item_position
success_subscriptionSuccessfully subscribes to a service.
  • PAYMENT_TYPE
  • TRANSACTION_ID
  • START_DATE
  • END_DATE
  • CURRENCY
  • PRICE
  • plan_id
  • plan_name
loginLogs in to the app.
  • signin_method
logoutSigns out of the app.
  • EVENT_NAME: logout, logout
MVPD_Selected

Selects an MVPD (multimedia video programming distributor) provider. Example, Comcast, DirecTV, Hulu.

  • tvprovider_name

MVPD_Provider_Page

Views the page for an MVPD provider(No parameters)
purchaseTrigger purchase events for any payment method, including third-party gateways like Stripe or PayPal.
  • ITEM_ID
  • ITEM_NAME
  • CURRENCY
  • VALUE
  • TRANSACTION_ID
sign_upSigns up for a service.
  • signup_method
tvod_purchase_completion

Completes the purchase of a TVOD (transactional video on demand) content.

  • ITEM_ID
  • ITEM_NAME
  • CURRENCY
  • VALUE
  • plan_id
  • plan_name
  • purchase_type
cancel_subscriptionCancels their subscription to a service.
  • ITEM_ID
  • ITEM_NAME
  • CURRENCY
  • VALUE
sign_outSigns out of the app.
  • EVENT_NAME: logout, logout
like_dislike_videoLikes or dislikes a video.(No parameters)
tray_eventInteracts with the tray, such as by opening or closing it.
  • page_name
  • tray_name
  • tray_position
  • item_name
  • item_position
program_startStarts watching a program.
  • video_name
  • program_name
stream_startStarts streaming a video.
  • FIREBASE_VIDEO_ID_KEY
  • FIREBASE_VIDEO_NAME_KEY
  • FIREBASE_PLAYER_NAME_KEY
  • FIREBASE_MEDIA_TYPE_KEY

stream_25_pct

Streamed 25% of a video.
  • FIREBASE_VIDEO_ID_KEY
  • FIREBASE_VIDEO_NAME_KEY
  • FIREBASE_PLAYER_NAME_KEY
  • FIREBASE_MEDIA_TYPE_KEY
stream_50_pctStreamed 50% of a video.
  • FIREBASE_VIDEO_ID_KEY
  • FIREBASE_VIDEO_NAME_KEY
  • FIREBASE_PLAYER_NAME_KEY
  • FIREBASE_MEDIA_TYPE_KEY
stream_75_pctStreamed 75% of a video.
  • FIREBASE_VIDEO_ID_KEY
  • FIREBASE_VIDEO_NAME_KEY
  • FIREBASE_PLAYER_NAME_KEY
  • FIREBASE_MEDIA_TYPE_KEY
stream_95_pctStreamed 95% of a video.
  • FIREBASE_VIDEO_ID_KEY
  • FIREBASE_VIDEO_NAME_KEY
  • FIREBASE_PLAYER_NAME_KEY
  • FIREBASE_MEDIA_TYPE_KEY
stream_100_pctStreamed 100% of a video.
  • FIREBASE_VIDEO_ID_KEY
  • FIREBASE_VIDEO_NAME_KEY
  • FIREBASE_PLAYER_NAME_KEY
  • FIREBASE_MEDIA_TYPE_KEY
ecommerce_purchase

Makes an ecommerce purchase.

  • FIREBASE_PLAN_ID
  • FIREBASE_PLAN_NAME
  • FIREBASE_CURRENCY_NAME
  • FIREBASE_VALUE
  • FIREBASE_TRANSACTION_ID
Authentication_SuccessSuccessfully authenticates with the app.(No parameters)
Authentication_FailureFails to authenticate with the app.(No parameters)
clip_startStarts watching a clip.
  • isclip
app_cms_iap_eventMakes an in-app purchase.
Note:
In-app purchase events are exclusively for purchases made through the app store's payment system.
  • category
  • action
  • vl_user
  • amazon_user
  • plan_identifier
  • receiptid
  • error_msg
  • device_detail
ga_eventInteracts with the app in a way that is not covered by any of the other events.
  • category
  • action
  • label
ad_startAn ad starts playing.
  • screen_view: AdView
ad_endAn ad ends playing.
  • screen_view: Ad End

ViewLift/GA4 events for Apple TV

Event nameEvent is pushed to GA4 when a user...
screen_view
Views a screen.
MVPD_Provider_PageVisits the website of an MVPD provider.
MVPD_Sign_In_Page
Visits the sign-in page of an MVPD provider.
MVPD_Selected
Selects an MVPD (multimedia video programming distributor) provider. Example, Comcast, DirecTV, Hulu.
Authentication_Success
Is successfully authorized with a login password or authorization with a code from a browser.
Authentication_Failure
Gets a “Verification failed” error on Apple TV.
Application Started
Opens your app.
page_viewViews a video detail page.
playerErrorEncounters some error in the player.
ad_startThe ad has started playing successfully on the Apple TV player.
ad_endThe ad has finished playing on the player.
program_start

A video is loaded on the player and starts playing.

FAQs - GA4

Q. How to find more data in the 'subscription success' event?

Once a subscription is completed, it creates an event named "subscription_event" in Google Analytics 4. This object holds the following information about subscription activity:

const eventItems = { 'Name': user.name, 'Email': user.email, 'userId': user.userId, 'subscriptionPlan': planDetails, 'subscriptionStartDate': currentDate, 'subscriptionEndDate': planDuration, 'transactionAmount': planAmount, 'paymentHandler': paymentMode, 'subscribed_via_platform': 'Web', 'subscribed_from_country': countryCode, 'localCurrency': currencyCode, }

Parameters and description

  • Name: The user's name
  • Email: The user's email address
  • UserId: The user's unique identifier
  • SubscriptionPlan: The name of the subscription plan
  • SubscriptionStartDate: The date the subscription started
  • SubscriptionEndDate: The date the subscription ends
  • TransactionAmount: The amount of the subscription
  • PaymentHandler: The method of payment used
  • SubscribedViaPlatform: The platform used to subscribe (in this case, "Web")
  • SubscribedFromCountry: The country the user is from
  • LocalCurrency: The user's local currency

Existing custom events in GA3 / Firebase

Following is a list of custom events that we currently track on the web and apps. To access the Events report, from your UA/Firebase property, click Reports > Engagement > Events

  • Page Viewed (page_view)
  • Added to Watchlist
  • Removed From Watchlist
  • Player BitRate changed
  • Play Started
  • Media Error
  • Watched
  • View Plans
  • Shared
  • Logout
  • Login
  • Signed Up
  • Subscription Initiated
  • Searched

Was this article helpful?