diff --git a/.jshintrc b/.jshintrc index 08096effa..0099433c0 100644 --- a/.jshintrc +++ b/.jshintrc @@ -2,7 +2,8 @@ "predef": [ "document", "window", - "-Promise" + "-Promise", + "ga" ], "browser": true, "boss": true, diff --git a/app/app.js b/app/app.js index 757df3899..8c8955da2 100644 --- a/app/app.js +++ b/app/app.js @@ -11,6 +11,21 @@ var App = Ember.Application.extend({ Resolver: Resolver }); +//Allow data-eventname to be set on link-to's +Ember.LinkView.reopen({ + attributeBindings: ['data-eventname'] +}); + +Ember.Router.reopen({ + notifyGoogleAnalytics: function() { + if (!ga) { return; } + return ga('send', 'pageview', { + 'page': this.get('url'), + 'title': this.get('url') + }); + }.on('didTransition') +}); + loadInitializers(App, config.modulePrefix); export default App; diff --git a/app/components/download-archive.js b/app/components/download-archive.js index e33740b0c..43f9efc65 100644 --- a/app/components/download-archive.js +++ b/app/components/download-archive.js @@ -18,7 +18,7 @@ export default Ember.Component.extend({ return new Ember.Handlebars.SafeString(message); }.property('isBuilding'), triggerArchiveDownload: function() { - window.location.href = this.archiveLink; + this.sendAction('download', this.archiveLink); }.observes('archiveLink'), actions: { handleClick: function(){ diff --git a/app/controllers/generator.js b/app/controllers/generator.js index 9c2e82485..c411105c1 100644 --- a/app/controllers/generator.js +++ b/app/controllers/generator.js @@ -54,6 +54,7 @@ export default Ember.Controller.extend({ actions: { updateStep: function(currentStep, nextStep) { if(currentStep) { + ga('send', 'event', 'item', 'click', 'generator-step-'+currentStep); this.set('steps.step'+currentStep+'.isCurrent', false); if(currentStep === '1') { this.set('step1Complete',true); diff --git a/app/index.html b/app/index.html index 99d091396..cfe208a91 100644 --- a/app/index.html +++ b/app/index.html @@ -16,7 +16,54 @@
{{content-for 'body'}} + + diff --git a/app/routes/generator.js b/app/routes/generator.js index ea1364ca9..900f5d976 100644 --- a/app/routes/generator.js +++ b/app/routes/generator.js @@ -25,9 +25,14 @@ export default Ember.Route.extend({ model.save(); }, buildArchive: function(){ + ga('send', 'event', 'item', 'click', 'generator-build-trigger'); var model = this.modelFor('generator'); model.build(); }, + downloadArchive: function(archiveLink){ + ga('send', 'event', 'item', 'click', 'generator-build-download'); + window.location.href = archiveLink; + }, updateManifest: function (result) { var model = this.modelFor('generator'); var controller = this.controllerFor('generator'); diff --git a/app/templates/generator.hbs b/app/templates/generator.hbs index 962b97024..798c82e7f 100644 --- a/app/templates/generator.hbs +++ b/app/templates/generator.hbs @@ -93,7 +93,7 @@ {{fa-icon "apple"}} {{/generator-step}} - {{#download-archive class="button-holder download-archive" isBuilding=model.isBuilding isEnabled=step1Complete action="buildArchive" archiveLink=model.archiveLink}} + {{#download-archive class="button-holder download-archive" isBuilding=model.isBuilding isEnabled=step1Complete action="buildArchive" download="downloadArchive" archiveLink=model.archiveLink}}{{#link-to 'deploy' class="usage-link"}}Now: Learn how to distribute this package across different platforms{{/link-to}}
{{/download-archive}} diff --git a/app/templates/index.hbs b/app/templates/index.hbs index f8e694fb4..fde9b4d78 100644 --- a/app/templates/index.hbs +++ b/app/templates/index.hbs @@ -6,7 +6,7 @@