mirror of
https://github.com/plausible/analytics.git
synced 2024-12-25 02:24:55 +03:00
Add fallback if websiteUrl is not defined
This commit is contained in:
parent
dce82833e9
commit
c83e038af0
@ -143,9 +143,15 @@ defmodule Plausible.Google.Api do
|
||||
Jason.decode!(res.body)
|
||||
|> Map.get("items")
|
||||
|> Enum.map(fn item ->
|
||||
uri = URI.parse(Map.get(item, "websiteUrl"))
|
||||
uri = URI.parse(Map.get(item, "websiteUrl", ""))
|
||||
|
||||
if !uri.host do
|
||||
Sentry.capture_message("No URI for view ID", extra: Jason.decode!(res.body))
|
||||
end
|
||||
|
||||
host = uri.host || Map.get(item, "id", "")
|
||||
name = Map.get(item, "name")
|
||||
{"#{uri.host} - #{name}", Map.get(item, "id")}
|
||||
{"#{host} - #{name}", Map.get(item, "id")}
|
||||
end)
|
||||
|> Map.new()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user