You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@toree.apache.org by lr...@apache.org on 2018/03/30 06:01:09 UTC

[2/3] incubator-toree-website git commit: Enable GA tracking for website

Enable GA tracking for website


Project: http://git-wip-us.apache.org/repos/asf/incubator-toree-website/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-toree-website/commit/0554bf87
Tree: http://git-wip-us.apache.org/repos/asf/incubator-toree-website/tree/0554bf87
Diff: http://git-wip-us.apache.org/repos/asf/incubator-toree-website/diff/0554bf87

Branch: refs/heads/master
Commit: 0554bf8775c874ed03b927f1399980b497130953
Parents: e8510b8
Author: Luciano Resende <lr...@apache.org>
Authored: Thu Mar 29 22:31:07 2018 -0700
Committer: Luciano Resende <lr...@apache.org>
Committed: Thu Mar 29 22:31:07 2018 -0700

----------------------------------------------------------------------
 site/_config.yml                                  |  8 +++++++-
 site/_includes/JB/analytics                       |  4 ++--
 .../JB/analytics-providers/google-universal       | 18 ++++++++----------
 3 files changed, 17 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-toree-website/blob/0554bf87/site/_config.yml
----------------------------------------------------------------------
diff --git a/site/_config.yml b/site/_config.yml
index 6fd56af..1527570 100644
--- a/site/_config.yml
+++ b/site/_config.yml
@@ -13,11 +13,17 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 #
+
 markdown: kramdown
 permalink: /news/:year/:month/:day/:title/
 excerpt_separator: ""
 
-repository: https://github.com/apache/apache-website-template
+# if 'analytics_on' is true, analytics section will be rendered on the HTML pages
+analytics_on: true
+analytics_provider: google_universal
+analytics_google_universal_tracking_id : UA-116672460-1
+
+repository: https://github.com/apache/incubator-toree-website
 destination: target
 exclude: [README.md,Gemfile*]
 keep_files: [".git", ".svn", "apidocs"]

http://git-wip-us.apache.org/repos/asf/incubator-toree-website/blob/0554bf87/site/_includes/JB/analytics
----------------------------------------------------------------------
diff --git a/site/_includes/JB/analytics b/site/_includes/JB/analytics
index 48d87c2..cbada67 100644
--- a/site/_includes/JB/analytics
+++ b/site/_includes/JB/analytics
@@ -1,6 +1,6 @@
-{% if site.safe and site.JB.analytics.provider and page.JB.analytics != false %}
+{% if site.analytics_on == true %}
 
-{% case site.JB.analytics.provider %}
+{% case site.analytics_provider %}
 {% when "google_classic" %}
   {% include JB/analytics-providers/google-classic %}
 {% when "google_universal" %}

http://git-wip-us.apache.org/repos/asf/incubator-toree-website/blob/0554bf87/site/_includes/JB/analytics-providers/google-universal
----------------------------------------------------------------------
diff --git a/site/_includes/JB/analytics-providers/google-universal b/site/_includes/JB/analytics-providers/google-universal
index dae744b..badfa3b 100644
--- a/site/_includes/JB/analytics-providers/google-universal
+++ b/site/_includes/JB/analytics-providers/google-universal
@@ -1,11 +1,9 @@
-<script type="text/javascript">
-  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
-  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
-  m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
-  })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
+<!-- Global site tag (gtag.js) - Google Analytics -->
+<script async src="https://www.googletagmanager.com/gtag/js?id={{ site.analytics_google_universal_tracking_id }}"></script>
+<script>
+  window.dataLayer = window.dataLayer || [];
+  function gtag(){dataLayer.push(arguments);}
+  gtag('js', new Date());
 
-  ga('create', '{{ site.JB.analytics.google_universal.tracking_id }}', '{{ site.JB.analytics.google_universal.domain }}');
-  ga('require', 'linkid', 'linkid.js');
-  ga('send', 'pageview');
-
-</script>
\ No newline at end of file
+  gtag('config', '{{ site.analytics_google_universal_tracking_id }}');
+</script>