Skip to content

Commit f1786b8

Browse files
committed
Add other events to Tracked events
Signed-off-by: Olga Bulat <obulat@gmail.com>
1 parent 10da0a8 commit f1786b8

File tree

3 files changed

+79
-23
lines changed

3 files changed

+79
-23
lines changed

src/components/HelpSection.vue

Lines changed: 54 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -8,53 +8,53 @@
88
<div class="columns" id="modal-buttons">
99
<div class="column top-bottom-paddingless">
1010
<button id="cc_license_btn" class="button is-light is-large is-fullwidth help-button"
11-
@click="isModal1Active = true">
11+
@click="clickHandler(1)">
1212
<p>
1313
{{ $t('help.what_are_cc_licenses.heading') }}
1414
</p>
1515
</button>
1616
<button id="license_work_btn" class="button is-light is-large is-fullwidth help-button"
17-
@click="isModal2Active = true">
17+
@click="clickHandler(2)">
1818
<p>
1919
{{ $t('help.how_licenses_work.heading') }}
2020
</p>
2121
</button>
2222
<button id="icons_meaning_btn" class="button is-light is-large is-fullwidth help-button"
23-
@click="isModal3Active = true">
23+
@click="clickHandler(3)">
2424
<p>
2525
{{ $t('help.what_icons_mean.heading') }}
2626
</p>
2727
</button>
2828
<button id="license_communication_btn" class="button is-light is-large is-fullwidth help-button"
29-
@click="isModal7Active = true">
29+
@click="clickHandler(7)">
3030
<p>
3131
{{ $t('help.how_licenses_communicated.heading') }}
3232
</p>
3333
</button>
3434
</div>
3535
<div class="column top-bottom-paddingless">
3636
<button id="consideration_btn" class="button is-light is-large is-fullwidth help-button"
37-
@click="isModal4Active = true">
37+
@click="clickHandler(4)">
3838
<p>
3939
{{ $t('help.considerations_before_licensing.heading') }}
4040
</p>
4141
</button>
4242
<button id="formal_license_btn" class="button is-light is-large is-fullwidth help-button"
43-
@click="isModal5Active = true">
43+
@click="clickHandler(5)">
4444
<p>
4545
{{ $t('help.how_formally_license.heading') }}
4646
</p>
4747
</button>
4848
<button id="license_description_btn" class="button is-light is-large is-fullwidth help-button"
49-
@click="isModal6Active = true">
49+
@click="clickHandler(6)">
5050
<p>
5151
{{ $t('help.six_cc_licenses.heading') }}
5252
</p>
5353
</button>
5454
</div>
5555
</div>
5656

57-
<b-modal :active.sync="isModal1Active">
57+
<b-modal :active.sync="modals[1].status">
5858
<header class="modal-card-head">
5959
<p class="modal-card-title modal-title" v-html="this.$t('help.what_are_cc_licenses.heading')"/>
6060
</header>
@@ -65,7 +65,7 @@
6565
</footer>
6666
</section>
6767
</b-modal>
68-
<b-modal :active.sync="isModal2Active">
68+
<b-modal :active.sync="modals[2].status">
6969
<header class="modal-card-head">
7070
<p class="modal-card-title modal-title">
7171
{{ $t('help.how_licenses_work.heading') }}
@@ -76,7 +76,7 @@
7676
<footer class="modal-card-foot" v-html="this.$t('help.how_licenses_work.footer')"/>
7777
</section>
7878
</b-modal>
79-
<b-modal :active.sync="isModal3Active">
79+
<b-modal :active.sync="modals[3].status">
8080
<header class="modal-card-head">
8181
<p class="modal-card-title modal-title">
8282
{{ $t('help.what_icons_mean.heading') }}
@@ -141,7 +141,7 @@
141141
</footer>
142142
</section>
143143
</b-modal>
144-
<b-modal :active.sync="isModal4Active">
144+
<b-modal :active.sync="modals[4].status">
145145
<header class="modal-card-head">
146146
<p class="modal-card-title modal-title">
147147
{{ $t('help.considerations_before_licensing.heading') }}
@@ -154,7 +154,7 @@
154154
</footer>
155155
</section>
156156
</b-modal>
157-
<b-modal :active.sync="isModal5Active">
157+
<b-modal :active.sync="modals[5].status">
158158
<header class="modal-card-head">
159159
<p class="modal-card-title modal-title">
160160
{{ $t('help.how_formally_license.heading') }}
@@ -164,7 +164,7 @@
164164
<article v-html="this.$t('help.how_formally_license.text')"/>
165165
</section>
166166
</b-modal>
167-
<b-modal :active.sync="isModal6Active">
167+
<b-modal :active.sync="modals[6].status">
168168
<header class="modal-card-head">
169169
<p class="modal-card-title modal-title">
170170
{{ $t('help.six_cc_licenses.heading') }}
@@ -187,7 +187,7 @@
187187
</footer>
188188
</section>
189189
</b-modal>
190-
<b-modal :active.sync="isModal7Active">
190+
<b-modal :active.sync="modals[7].status">
191191
<header class="modal-card-head">
192192
<p class="modal-card-title modal-title">{{ $t('help.how_licenses_communicated.heading') }}
193193
</p>
@@ -242,13 +242,46 @@ export default {
242242
data() {
243243
return {
244244
sixLicensesImg: '<img src="../assets/license-openness-scale.png">',
245-
isModal1Active: false,
246-
isModal2Active: false,
247-
isModal3Active: false,
248-
isModal4Active: false,
249-
isModal5Active: false,
250-
isModal6Active: false,
251-
isModal7Active: false
245+
modals: {
246+
1: {
247+
status: false,
248+
title: 'what_are_cc_licenses'
249+
},
250+
2: {
251+
status: false,
252+
title: 'how_licenses_work'
253+
},
254+
3: {
255+
status: false,
256+
title: 'what_icons_mean'
257+
},
258+
4: {
259+
status: false,
260+
title: 'considerations_before_licensing'
261+
},
262+
5: {
263+
status: false,
264+
title: 'how_formally_license'
265+
},
266+
6: {
267+
status: false,
268+
title: 'six_cc_licenses'
269+
},
270+
7: {
271+
status: false,
272+
title: 'how_licenses_communicated'
273+
}
274+
}
275+
}
276+
},
277+
methods: {
278+
clickHandler(modalNumber) {
279+
this.modals[modalNumber].status = true
280+
this.$ga.event({
281+
eventCategory: 'HelpSection',
282+
eventAction: 'clicked',
283+
eventLabel: this.modals[modalNumber].title
284+
})
252285
}
253286
}
254287
}

src/components/SelectedLicenseCode.vue

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,28 @@ export default {
7878
methods: {
7979
onCopySuccess(e) {
8080
this.success = true
81+
this.$ga.event({
82+
eventCategory: 'Attribution',
83+
eventAction: 'copied',
84+
// Label is either rich-text or html
85+
eventLabel: this.currentSelection,
86+
// Value is the license copied
87+
eventValue: this.$props.value.shortName
88+
})
89+
const fieldsFilledIn = []
90+
for (const detail in this.$props.value.attributionDetails) {
91+
if (this.$props.value.attributionDetails[detail] !== '') {
92+
fieldsFilledIn.push(detail)
93+
}
94+
}
95+
fieldsFilledIn.forEach((field) => {
96+
this.$ga.event({
97+
eventCategory: 'AttributionDetails',
98+
eventAction: 'filledIn',
99+
// Label is the field that is not blank when a user copies the license
100+
eventLabel: field
101+
})
102+
})
81103
this.$emit('copied', { content: e.text })
82104
setTimeout(() => {
83105
this.success = false

src/components/Stepper.vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,9 +145,10 @@ export default {
145145
attributionDetails: this.$props.value.attributionDetails
146146
}
147147
this.$ga.event({
148-
eventCategory: 'stepper',
148+
eventCategory: 'Stepper',
149149
eventAction: 'clicked',
150-
eventLabel: licenseData.shortName
150+
eventLabel: itemId,
151+
eventValue: licenseData.shortName
151152
})
152153
this.$emit('input', licenseData)
153154
},

0 commit comments

Comments
 (0)