Skip to content

Commit 465529a

Browse files
authored
Merge pull request #90 from creativecommons/ga-production-only
Only send analytics data in production mode
2 parents e924cb5 + cb0249e commit 465529a

File tree

12 files changed

+47
-38
lines changed

12 files changed

+47
-38
lines changed

docs/css/app.be17c10c.css renamed to docs/css/app.eb482f5e.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<!DOCTYPE html><html lang=en><head><meta charset=utf-8><meta http-equiv=X-UA-Compatible content="IE=edge"><meta name=viewport content="width=device-width,initial-scale=1"><link rel=icon href=/favicon.ico><link rel=icon type=image/png href=https://d15omoko64skxi.cloudfront.net/wp-content/uploads/2016/05/cc-site-icon-300x300.png sizes=192x192><link rel=apple-touch-icon-precomposed href=https://d15omoko64skxi.cloudfront.net/wp-content/uploads/2016/05/cc-site-icon-300x300.png><meta name=twitter:card content=summary><meta name=twitter:site content=@creativecommons><meta name=twitter:creator content=@creativecommons><meta property=og:url content=https://beta-chooser.creativecommons.org><meta property=og:title content="Choose a License"><meta property=og:type content=website><meta property=og:description content="Want to license your work with Creative Commons, but not sure where to start, or which license is right for you? Use our license chooser!"><meta property=og:image content=https://mirrors.creativecommons.org/presskit/logos/cc.logo.large.png><meta property=og:locale content=en_US><meta property=og:locale:alternate content=ru_RU><title>Creative Commons License Chooser</title><link href=/css/app.be17c10c.css rel=preload as=style><link href=/css/chunk-vendors.c29f3e02.css rel=preload as=style><link href=/js/app.a2177d79.js rel=preload as=script><link href=/js/chunk-vendors.f29b9692.js rel=preload as=script><link href=/css/chunk-vendors.c29f3e02.css rel=stylesheet><link href=/css/app.be17c10c.css rel=stylesheet></head><body><noscript><strong>We're sorry but License Chooser doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id=app></div><script src=/js/chunk-vendors.f29b9692.js></script><script src=/js/app.a2177d79.js></script></body></html>
1+
<!DOCTYPE html><html lang=en><head><meta charset=utf-8><meta http-equiv=X-UA-Compatible content="IE=edge"><meta name=viewport content="width=device-width,initial-scale=1"><link rel=icon href=/favicon.ico><link rel=icon type=image/png href=https://d15omoko64skxi.cloudfront.net/wp-content/uploads/2016/05/cc-site-icon-300x300.png sizes=192x192><link rel=apple-touch-icon-precomposed href=https://d15omoko64skxi.cloudfront.net/wp-content/uploads/2016/05/cc-site-icon-300x300.png><meta name=twitter:card content=summary><meta name=twitter:site content=@creativecommons><meta name=twitter:creator content=@creativecommons><meta property=og:url content=https://beta-chooser.creativecommons.org><meta property=og:title content="Choose a License"><meta property=og:type content=website><meta property=og:description content="Want to license your work with Creative Commons, but not sure where to start, or which license is right for you? Use our license chooser!"><meta property=og:image content=https://mirrors.creativecommons.org/presskit/logos/cc.logo.large.png><meta property=og:locale content=en_US><meta property=og:locale:alternate content=ru_RU><title>Creative Commons License Chooser</title><link href=/css/app.eb482f5e.css rel=preload as=style><link href=/css/chunk-vendors.c29f3e02.css rel=preload as=style><link href=/js/app.7e6af1b9.js rel=preload as=script><link href=/js/chunk-vendors.f29b9692.js rel=preload as=script><link href=/css/chunk-vendors.c29f3e02.css rel=stylesheet><link href=/css/app.eb482f5e.css rel=stylesheet></head><body><noscript><strong>We're sorry but License Chooser doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id=app></div><script src=/js/chunk-vendors.f29b9692.js></script><script src=/js/app.7e6af1b9.js></script></body></html>

docs/js/app.7e6af1b9.js

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/js/app.7e6af1b9.js.map

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/js/app.a2177d79.js

Lines changed: 0 additions & 2 deletions
This file was deleted.

docs/js/app.a2177d79.js.map

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/App.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,9 @@ export default {
4949
},
5050
created: function() {
5151
// send home to google analytics
52-
this.$ga.page('/')
52+
if (process.env.NODE_ENV === 'production') {
53+
this.$ga.page('/')
54+
}
5355
}
5456
}</script>
5557
<style lang="scss">

src/components/HelpSection.vue

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -277,11 +277,13 @@ export default {
277277
methods: {
278278
clickHandler(modalNumber) {
279279
this.modals[modalNumber].status = true
280-
this.$ga.event({
281-
eventCategory: 'HelpSection',
282-
eventAction: 'clicked',
283-
eventLabel: this.modals[modalNumber].title
284-
})
280+
if (process.env.NODE_ENV === 'production') {
281+
this.$ga.event({
282+
eventCategory: 'HelpSection',
283+
eventAction: 'clicked',
284+
eventLabel: this.modals[modalNumber].title
285+
})
286+
}
285287
}
286288
}
287289
}

src/components/SelectedLicenseCode.vue

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -78,21 +78,23 @@ export default {
7878
methods: {
7979
onCopySuccess(e) {
8080
this.success = true
81-
const fieldsFilled = {}
82-
for (const detail in this.$props.value.attributionDetails) {
83-
fieldsFilled[detail] = this.$props.value.attributionDetails[detail] !== ''
84-
}
85-
const copiedLicense = {
86-
license: this.$props.value.shortName,
87-
// codeType can be either rich-text or html
88-
codeType: this.currentSelection,
89-
fieldsFilled: fieldsFilled
81+
if (process.env.NODE_ENV === 'production') {
82+
const fieldsFilled = {}
83+
for (const detail in this.$props.value.attributionDetails) {
84+
fieldsFilled[detail] = this.$props.value.attributionDetails[detail] !== ''
85+
}
86+
const copiedLicense = {
87+
license: this.$props.value.shortName,
88+
// codeType can be either rich-text or html
89+
codeType: this.currentSelection,
90+
fieldsFilled: fieldsFilled
91+
}
92+
this.$ga.event({
93+
eventCategory: 'Attribution',
94+
eventAction: 'copied',
95+
eventLabel: JSON.stringify(copiedLicense)
96+
})
9097
}
91-
this.$ga.event({
92-
eventCategory: 'Attribution',
93-
eventAction: 'copied',
94-
eventLabel: JSON.stringify(copiedLicense)
95-
})
9698
this.$emit('copied', { content: e.text })
9799
setTimeout(() => {
98100
this.success = false

src/components/SelectedLicenseDropdown.vue

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,13 @@ export default {
5151
},
5252
set(currentLicense) {
5353
const fullLicenseName = this.fullLicenseName(currentLicense)
54-
this.$ga.event({
55-
eventCategory: 'LicenseDropdown',
56-
eventAction: 'licenseSelected',
57-
eventLabel: currentLicense
58-
})
54+
if (process.env.NODE_ENV === 'production') {
55+
this.$ga.event({
56+
eventCategory: 'LicenseDropdown',
57+
eventAction: 'licenseSelected',
58+
eventLabel: currentLicense
59+
})
60+
}
5961
this.$emit('input', { ...this.$props.value, fullName: fullLicenseName, shortName: currentLicense })
6062
}
6163
}

0 commit comments

Comments
 (0)