Stop importing page referrer from GA4 (#4012)

* Stop importing page referrer from GA4

* Update GA4 import fixture

* Update fixture-based test
This commit is contained in:
Adrian Gruntkowski 2024-04-16 15:35:36 +02:00 committed by GitHub
parent 350d42fb95
commit c07f00636d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 883 additions and 38484 deletions

File diff suppressed because it is too large Load Diff

View File

@ -46,8 +46,7 @@ defmodule Plausible.Google.GA4.ReportRequest do
"sessionMedium",
"sessionCampaignName",
"sessionManualAdContent",
"sessionGoogleAdsKeyword",
"pageReferrer"
"sessionGoogleAdsKeyword"
],
metrics: [
"screenPageViews",

View File

@ -96,19 +96,12 @@ defmodule Plausible.Imported.GoogleAnalytics4 do
end
defp new_from_report(site_id, import_id, "imported_sources", row) do
referrer_uri = row.dimensions |> Map.fetch!("pageReferrer") |> URI.parse()
referrer =
if PlausibleWeb.RefInspector.right_uri?(referrer_uri) do
PlausibleWeb.RefInspector.format_referrer(referrer_uri)
end
%{
site_id: site_id,
import_id: import_id,
date: get_date(row),
source: row.dimensions |> Map.fetch!("sessionSource") |> parse_referrer(),
referrer: referrer,
referrer: nil,
# Only `source` exists in GA4 API
utm_source: nil,
utm_medium: row.dimensions |> Map.fetch!("sessionMedium") |> default_if_missing(),

View File

@ -82,7 +82,7 @@ defmodule Plausible.Imported.GoogleAnalytics4Test do
Enum.each(Plausible.Imported.tables(), fn table ->
count =
case table do
"imported_sources" -> 1090
"imported_sources" -> 210
"imported_visitors" -> 31
"imported_pages" -> 3340
"imported_entry_pages" -> 2934