diff options
author | matthieu <matthieu.cneude@gmail.com> | 2021-04-23 14:10:38 +0200 |
---|---|---|
committer | matthieu <matthieu.cneude@gmail.com> | 2021-04-23 14:10:38 +0200 |
commit | 6e0e182f22aa33e85e2f4614ee6a448384bf02b0 (patch) | |
tree | 750d56e481c29b3364748bd518a7e36c9844445f | |
parent | 05042039477791ce56b48b309a368e34d2fd4b70 (diff) |
[next-release]
-rw-r--r-- | internal/templates.go | 158 |
1 files changed, 147 insertions, 11 deletions
diff --git a/internal/templates.go b/internal/templates.go index 09180d6..4c8798c 100644 --- a/internal/templates.go +++ b/internal/templates.go @@ -1,25 +1,161 @@ package internal -func DefaultTemplate() string { - return `--- -general: - refresh: 600 - keys: - quit: "C-c" - hot_reload: "C-r" +type blogConfig struct { + Keyfile string + Address string + ViewID string +} + +func CreateBlogConfig(keyfile string, viewID string, address string) blogConfig { + bc := blogConfig{} + if keyfile != "" { + bc.Keyfile = "keyfile: " + keyfile + } else { + bc.Keyfile = "# keyfile: env variable DEVDASH_GA_KEYFILE" + } + + if address != "" { + bc.Address = "address: " + address + } else { + bc.Address = "# address: The value of the address is required" + } + if viewID != "" { + bc.ViewID = "view_id: " + viewID + } else { + bc.ViewID = "# view_id: The value of the address is required" + } + + return bc +} + +func GA() string { + return `--- projects: - - name: Default dashboard located at $HOME/.config/devdash/default.yml + - name: https://thevaluable.dev - General + title_options: + border_color: default + text_color: default + size: XXL + bold: true services: + google_analytics: + {{ .Keyfile }} + {{ .ViewID }} + view_id: 89379071 + feedly: + {{ .Address }} monitor: - address: "https://thevaluable.dev" + {{ .Address }} + google_search_console: + {{ .Keyfile }} + # keyfile: env variable DEVDASH_GSC_KEYFILE + {{ .Address }} + themes: + table: + color: blue + box: + color: green + text_color: default + widgets: - row: - col: size: "M" elements: + - name: ga.bar_sessions + options: + start_date: "10_days_ago" + end_date: "today" + color: yellow + num_color: black + bar_gap: 1 + bar_width: 6 + - name: ga.bar_sessions + options: + start_date: "12_months_ago" + end_date: "this_month" + time_period: month + color: red + bar_width: 8 + num_color: black + bar_gap: 1 + - col: + size: "S" + elements: + - name: ga.bar_new_returning + options: + start_date: "5_months_ago" + end_date: "this_month" + time_period: month + metric: "users" + title_color: blue + bar_width: 8 + num_color: black + bar_gap: 2 + height: 20 + - col: + size: "XS" + elements: + - name: ga.box_real_time + options: - name: mon.box_availability options: - title: " thevaluable.dev status " - color: yellow` + num_color: default + - name: ga.box_total + options: + title: "Average session duration this month" + metric: "ga:avgSessionDuration" + start_date: this_month + end_date: this_month + - name: ga.box_total + options: + title: "sessions/users 2 weeks ago" + metric: "ga:sessionsPerUser" + start_date: 2_weeks_ago + end_date: 2_weeks_ago + - name: ga.box_total + options: + title: "sessions/users 1 week ago" + metric: "ga:sessionsPerUser" + start_date: last_week + end_date: last_week + - name: ga.box_total + options: + title: "Total Users From Beginning" + metric: "users" + start_date: 30_months_ago + end_date: today + - name: ga.box_total + options: + title: "Bounce Rate (%) this month" + metric: "ga:bounceRate" + start_date: this_month + end_date: this_month + - name: feedly.box_subscribers + options: + title: "Feedly" + - row: + - col: + size: "S" + elements: + - name: ga.table_traffic_sources + options: + title: " Sources | Today " + start_date: "today" + end_date: "today" + row_limit: 17 + - col: + size: "S" + elements: + - name: ga.table + options: + title: " Referrers " + dimension: "ga:fullReferrer" + metrics: "sessions" + start_date: "today" + end_date: "today" + row_limit: 100 + character_limit: 65 + ` } |