Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/views/projects/product_analytics')
-rw-r--r--app/views/projects/product_analytics/_graph.html.haml6
-rw-r--r--app/views/projects/product_analytics/_links.html.haml10
-rw-r--r--app/views/projects/product_analytics/_tracker.html.erb10
-rw-r--r--app/views/projects/product_analytics/graphs.html.haml12
-rw-r--r--app/views/projects/product_analytics/index.html.haml16
-rw-r--r--app/views/projects/product_analytics/setup.html.haml12
-rw-r--r--app/views/projects/product_analytics/test.html.haml16
7 files changed, 82 insertions, 0 deletions
diff --git a/app/views/projects/product_analytics/_graph.html.haml b/app/views/projects/product_analytics/_graph.html.haml
new file mode 100644
index 00000000000..fd81a248005
--- /dev/null
+++ b/app/views/projects/product_analytics/_graph.html.haml
@@ -0,0 +1,6 @@
+- graph = local_assigns.fetch(:graph)
+
+%h3
+ = graph[:id]
+
+.js-project-analytics-chart{ "data-chart-data": graph.to_json, "data-chart-id": graph[:id] }
diff --git a/app/views/projects/product_analytics/_links.html.haml b/app/views/projects/product_analytics/_links.html.haml
new file mode 100644
index 00000000000..0797c5baf91
--- /dev/null
+++ b/app/views/projects/product_analytics/_links.html.haml
@@ -0,0 +1,10 @@
+.mb-3
+ %ul.nav-links
+ = nav_link(path: 'product_analytics#index') do
+ = link_to _('Events'), project_product_analytics_path(@project)
+ = nav_link(path: 'product_analytics#graphs') do
+ = link_to 'Graphs', graphs_project_product_analytics_path(@project)
+ = nav_link(path: 'product_analytics#test') do
+ = link_to _('Test'), test_project_product_analytics_path(@project)
+ = nav_link(path: 'product_analytics#setup') do
+ = link_to _('Setup'), setup_project_product_analytics_path(@project)
diff --git a/app/views/projects/product_analytics/_tracker.html.erb b/app/views/projects/product_analytics/_tracker.html.erb
new file mode 100644
index 00000000000..dbb96f19e22
--- /dev/null
+++ b/app/views/projects/product_analytics/_tracker.html.erb
@@ -0,0 +1,10 @@
+;(function(p,l,o,w,i,n,g){if(!p[i]){p.GlobalSnowplowNamespace=p.GlobalSnowplowNamespace||[];
+p.GlobalSnowplowNamespace.push(i);p[i]=function(){(p[i].q=p[i].q||[]).push(arguments)
+};p[i].q=p[i].q||[];n=l.createElement(o);g=l.getElementsByTagName(o)[0];n.async=1;
+n.src=w;g.parentNode.insertBefore(n,g)}}(window,document,"script","<%= product_analytics_tracker_url -%>","snowplow<%= @random -%>"));
+snowplow<%= @random -%>("newTracker", "sp", "<%= product_analytics_tracker_collector_url -%>", {
+ appId: "<%= @project_id -%>",
+ platform: "<%= @platform -%>",
+ eventMethod: "get"
+});
+snowplow<%= @random -%>('trackPageView');
diff --git a/app/views/projects/product_analytics/graphs.html.haml b/app/views/projects/product_analytics/graphs.html.haml
new file mode 100644
index 00000000000..89286061594
--- /dev/null
+++ b/app/views/projects/product_analytics/graphs.html.haml
@@ -0,0 +1,12 @@
+- page_title _('Product Analytics')
+
+= render 'links'
+
+%p
+ = _('Showing graphs based on events of the last %{timerange} days.') % { timerange: @timerange }
+
+- @graphs.each_slice(2) do |pair|
+ .row.append-bottom-10
+ - pair.each do |graph|
+ .col-md-6{ id: graph[:id] }
+ = render 'graph', graph: graph
diff --git a/app/views/projects/product_analytics/index.html.haml b/app/views/projects/product_analytics/index.html.haml
new file mode 100644
index 00000000000..386f9265179
--- /dev/null
+++ b/app/views/projects/product_analytics/index.html.haml
@@ -0,0 +1,16 @@
+- page_title _('Product Analytics')
+
+= render 'links'
+
+- if @events.any?
+ %p
+ - if @events.total_count > @events.size
+ = _('Number of events for this project: %{total_count}.') % { total_count: number_with_delimiter(@events.total_count) }
+ %ol
+ - @events.each do |event|
+ %li
+ %code= event.as_json_wo_empty
+- else
+ .empty-state
+ .text-content
+ = _('There are currently no events.')
diff --git a/app/views/projects/product_analytics/setup.html.haml b/app/views/projects/product_analytics/setup.html.haml
new file mode 100644
index 00000000000..e1819c7d74b
--- /dev/null
+++ b/app/views/projects/product_analytics/setup.html.haml
@@ -0,0 +1,12 @@
+- page_title _('Product Analytics')
+
+= render 'links'
+
+%p
+ = _('Copy the code below to implement tracking in your application:')
+
+%pre
+ = render "tracker"
+
+%p.hint
+ = _('A platform value can be web, mob or app.')
diff --git a/app/views/projects/product_analytics/test.html.haml b/app/views/projects/product_analytics/test.html.haml
new file mode 100644
index 00000000000..60d897ee138
--- /dev/null
+++ b/app/views/projects/product_analytics/test.html.haml
@@ -0,0 +1,16 @@
+- page_title _('Product Analytics')
+
+= render 'links'
+
+%p
+ = _('This page sends a payload. Go back to the events page to see a newly created event.')
+
+- if @event
+ %p
+ = _('Last item before this page loaded in your browser:')
+
+ %code
+ = @event.as_json_wo_empty
+
+:javascript
+ #{render 'tracker'}