From 74e378a45f5e2be806dc532da90277b1c341272f Mon Sep 17 00:00:00 2001 From: rcmdnk Date: Thu, 14 Sep 2023 12:08:20 +0000 Subject: [PATCH] feat: update Google Analytics API v3 -> v4 --- .plugins/octopress-popular-posts | 2 +- .plugins/octopress-share-numbers | 2 +- Gemfile | 2 +- _config.yml | 24 ++++++++++-------------- patches/Gemfile.patch | 2 +- patches/_config.yml.patch | 24 ++++++++++-------------- source/posts.md | 10 +++++----- 7 files changed, 29 insertions(+), 37 deletions(-) diff --git a/.plugins/octopress-popular-posts b/.plugins/octopress-popular-posts index cc92157..9c7e364 160000 --- a/.plugins/octopress-popular-posts +++ b/.plugins/octopress-popular-posts @@ -1 +1 @@ -Subproject commit cc92157ccd42ffb8a81e441f45de33504e540b2a +Subproject commit 9c7e364cda5af577d75a8c08c27a996e47b7c104 diff --git a/.plugins/octopress-share-numbers b/.plugins/octopress-share-numbers index 9e040c1..94fed6e 160000 --- a/.plugins/octopress-share-numbers +++ b/.plugins/octopress-share-numbers @@ -1 +1 @@ -Subproject commit 9e040c1f3b4a4c620084b94250c305cff9273470 +Subproject commit 94fed6ef68a991087073c31010251dbcf7393983 diff --git a/Gemfile b/Gemfile index 7408a15..5d6ceb3 100644 --- a/Gemfile +++ b/Gemfile @@ -10,7 +10,7 @@ group :development do gem 'stringex', '~> 2.8' gem 'chronic', '~> 0.10' gem 'gemoji', '~> 2.0' - gem 'google-api-client', '~> 0.53' + gem 'google-analytics-data', '~> 0.4.0' gem 'htmlcompressor', '~> 0.4' gem 'jekyll-paginate', '~> 1.1' gem 'json', '~> 2.6' diff --git a/_config.yml b/_config.yml index 7d43b64..7074c5f 100644 --- a/_config.yml +++ b/_config.yml @@ -316,22 +316,18 @@ userlocal: # page-view settings (need service account private key file (key_file). ref: https://github.com/developmentseed/jekyll-ga) page-view: - service_account_email: + credential: key_file: # service account private key file (Analytics-XXXXXXXXXXXX.p12) - key_secret: notasecret # service account private key's password - profileID: #ga:XXXXXXXX + property_id: # Analytics property id (XXXXXXXX) start: # Beginning of report - - 1 month ago - - 10 years ago - - 1 year ago - - 1 week ago - - 1 day ago - end: now # End of report - metric: ga:pageviews # Metric code - segment: gaid::-1 # all visits - filters: # optional - n_posts: 5 # Number of popular posts - show_views: false # If n_views is shown or not + - 30daysAgo + - 3653daysAgo + - 365daysAgo + - 7daysAgo + - 1daysAgo + end: today # End of report + n_posts: 5 # Number of popular posts + show_views: true # If n_views is shown or not popular_post_title: Most Viewed Posts (Last Month) # Title of sidebar section # Random posts diff --git a/patches/Gemfile.patch b/patches/Gemfile.patch index e3b1f76..ceb130d 100644 --- a/patches/Gemfile.patch +++ b/patches/Gemfile.patch @@ -27,7 +27,7 @@ index 5683812..066ef1f 100644 + gem 'stringex', '~> 2.8' + gem 'chronic', '~> 0.10' + gem 'gemoji', '~> 2.0' -+ gem 'google-api-client', '~> 0.53' ++ gem 'google-analytics-data', '~> 0.4.0' + gem 'htmlcompressor', '~> 0.4' + gem 'jekyll-paginate', '~> 1.1' + gem 'json', '~> 2.6' diff --git a/patches/_config.yml.patch b/patches/_config.yml.patch index 75bc008..8ebc4e8 100644 --- a/patches/_config.yml.patch +++ b/patches/_config.yml.patch @@ -341,22 +341,18 @@ index c1d56f4..d6d2191 100644 + +# page-view settings (need service account private key file (key_file). ref: https://github.com/developmentseed/jekyll-ga) +page-view: -+ service_account_email: ++ credential: + key_file: # service account private key file (Analytics-XXXXXXXXXXXX.p12) -+ key_secret: notasecret # service account private key's password -+ profileID: #ga:XXXXXXXX ++ property_id: # Analytics property id (XXXXXXXX) + start: # Beginning of report -+ - 1 month ago -+ - 10 years ago -+ - 1 year ago -+ - 1 week ago -+ - 1 day ago -+ end: now # End of report -+ metric: ga:pageviews # Metric code -+ segment: gaid::-1 # all visits -+ filters: # optional -+ n_posts: 5 # Number of popular posts -+ show_views: false # If n_views is shown or not ++ - 30daysAgo ++ - 3653daysAgo ++ - 365daysAgo ++ - 7daysAgo ++ - 1daysAgo ++ end: today # End of report ++ n_posts: 5 # Number of popular posts ++ show_views: true # If n_views is shown or not +popular_post_title: Most Viewed Posts (Last Month) # Title of sidebar section + +# Random posts diff --git a/source/posts.md b/source/posts.md index 7903ed0..b5134f8 100644 --- a/source/posts.md +++ b/source/posts.md @@ -17,15 +17,15 @@ share_check_all: true