Cofacts Google Analytics 4 migration research
On July 1, 2023, standard Universal Analytics properties will stop processing new hits. We should migrate all Cofacts’ existing Universal Analytics properties to Google Analytics 4.
Existing properties
- website
- website (dev)
- LINE bot
- LINE bot (staging)
- Hackfoldr
- Analytics
- kktix
Existing integrations
- cofacts.tw/analytics reports - website & LINE
- Data studio pulls historical data on the fly
- article website trend & chatbot trend
- website trend uses content grouping to extract article ID
- pulled data is stored in
analyticscollection
- Search console integration
Migration of integrations
Account structure
- 1 Account
- 1 Property (shares same user base in
rumors-api) for chatbot & website? - Data streams
- 1 stream for all?
- Separate by host Hostname dimension?
- 1 web stream for website & 1 web stream for chatbot?
- 1 stream for all?
Need to consider:
Event parameter unification across chatbot & website?
- event name:
select_content - parameters:
item_id= article or reply ID,item_category= article or reply or …
Each event name is not necessarily unique (in fact, it’s best practice to reuse the same event name many times, differentiating the event by the parameter values collected). For example, a sign-up might have an event name of sign_up with parameters page_location, product, form_id, and so on. The same event name could (and should) be used on every sign up button across the site (whereas in UA, you would want to use unique event naming for each button). – https://support.google.com/analytics/answer/11986666#event_count&zippy=%2Cin-this-article
Website
- Recommended events:
login,search,share,select_content,level_up - No content grouping, must come up with other way to specify article ID
Integration
Datalayer variables and GA user properties
Parameters
Page view from RSS - manual utm tagging still works https://support.google.com/analytics/answer/11242870
LINE bot webhook
- Recommended events:
tutorial_begin,tutorial_complete
Integration
- Measurement protocol does not support customized
client_id - Use Firebase API? https://firebase.google.com/docs/analytics/events?hl=en&platform=web
Parameters
- event category / action / label: change to name & custom params
- Article LIFF traffic source dimensions - manual utm tagging still works https://support.google.com/analytics/answer/11242870
LIFF
- A web app that already uses
gtag() - Uses
gtag('event', 'ViewArticle', {event_category: 'LIFF', event_label: 'articleId'})- action –> GA4 event name
- category and label –> GA4 event parameters
- Custom event names
ChooseArticleViewArticleCommentViewReply
- UA event names
page_redirect: tracking LIFF redirect, probably not used by anyone……page_view
Integration
- UA –> GA4 dimension & metric equivalence
- Export to BigQuery to combine with old data (transformed to bigquery format)?
- then rewire all analytics charts to BigQuery?
Alternative: Woopra
Pros
- Down-to-event reports
- Down-to-user funnel
- Easy tracking API https://docs.woopra.com/reference/intro-http-tracking
- Super clear reporting API https://docs.woopra.com/reference/intro-http-apis
Cons
- Free quota: 500,000 actions/month
- Free data retention: 90 days
- No ready-made datastudio connector
- No filtering param in reporting APIs
- Filtering is done using UI in reports; reporting API gets data of a specific report ID
Alternative: Google BigQuery
Pros
- GA4 also exports to BQ, so that API cronjob can work on BQ only
- Manual 1-time setup for Google BigQuery dataset and tables
- (Can create a script instead)
Cons
- Cost?
Usage
Pricing
Estimate: 每日 20,000 次 insert,每個 50 byte –> 1MB / day

似乎不用擔心價錢。
Bigquery tables by GA
Comparison with GA
events_* table
- Data retention: ?
events_intradays_* table
- Data retention: 2 days