From 608f1ba33f7c9010462ede40386c1912949da51e Mon Sep 17 00:00:00 2001 From: iamkun <kunhello@outlook.com> Date: Mon, 4 Mar 2019 16:15:48 +0800 Subject: [PATCH] chore: update ga tracking (#14560) * chore: update ga tracking * chore: update development mock --- .eslintrc | 1 + examples/components/theme-configurator/index.vue | 1 + examples/index.tpl | 3 +++ examples/pages/template/resource.tpl | 10 ++++++++-- 4 files changed, 13 insertions(+), 2 deletions(-) diff --git a/.eslintrc b/.eslintrc index 7e75b60a9..297e042cf 100644 --- a/.eslintrc +++ b/.eslintrc @@ -3,6 +3,7 @@ "mocha": true }, "globals": { + "ga": true, "expect": true, "sinon": true }, diff --git a/examples/components/theme-configurator/index.vue b/examples/components/theme-configurator/index.vue index 96f1158d7..3740d3af0 100644 --- a/examples/components/theme-configurator/index.vue +++ b/examples/components/theme-configurator/index.vue @@ -143,6 +143,7 @@ export default { getVars() .then((res) => { defaultConfig = res; + ga('send', 'event', 'ThemeConfigurator', 'Init'); }) .catch((err) => { this.onError(err); diff --git a/examples/index.tpl b/examples/index.tpl index d3cfe316a..1ddfb997e 100644 --- a/examples/index.tpl +++ b/examples/index.tpl @@ -35,4 +35,7 @@ ga('send', 'pageview'); }); </script><% } %> + <% if (process.env.NODE_ENV !== 'production') { %><script> + var ga = function() {}; + </script><% } %> </html> diff --git a/examples/pages/template/resource.tpl b/examples/pages/template/resource.tpl index bebc8e274..2b1cbaea8 100644 --- a/examples/pages/template/resource.tpl +++ b/examples/pages/template/resource.tpl @@ -142,7 +142,10 @@ <img src="~examples/assets/images/Axure-Components.svg" alt=""> <h3><%= 3 ></h3> <p><%= 4 ></p> - <a href="https://github.com/ElementUI/Resources/raw/master/Element_Components_v2.0.0.rplib"><%= 5 ></a> + <a + onclick="ga('send', 'event', 'ResourceDownload', 'Download', 'Axure');" + href="https://github.com/ElementUI/Resources/raw/master/Element_Components_v2.0.0.rplib" + ><%= 5 ></a> </div> </li> <li> @@ -150,7 +153,10 @@ <img src="~examples/assets/images/Sketch-Template.svg" alt=""> <h3><%= 6 ></h3> <p><%= 7 ></p> - <a href="https://github.com/ElementUI/Resources/raw/master/Element%20UI%20Kit_v2.0.sketch"><%= 5 ></a> + <a + onclick="ga('send', 'event', 'ResourceDownload', 'Download', 'Sketch');" + href="https://github.com/ElementUI/Resources/raw/master/Element%20UI%20Kit_v2.0.sketch" + ><%= 5 ></a> </div> </li> <!--<li>-->