File tree Expand file tree Collapse file tree
contentcuration/contentcuration/frontend/shared Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -4,11 +4,9 @@ import { Analytics } from 'shared/composables/useAnalytics';
44
55/**
66 * @param Vue
7- * @param {Object } options
8- * @param {Array } options.dataLayer
97 */
10- export default function AnalyticsPlugin ( Vue , options = { } ) {
11- const analytics = new Analytics ( options . dataLayer ) ;
8+ export default function AnalyticsPlugin ( Vue ) {
9+ const analytics = Analytics . getInstance ( ) ;
1210
1311 // Merge in old dataLayer
1412 if ( Vue . $analytics ) {
Original file line number Diff line number Diff line change @@ -252,7 +252,7 @@ Vue.use(Vuetify, {
252252Vue . use ( KThemePlugin ) ;
253253
254254// Register analytics plugin with dataLayer that should already be defined
255- Vue . use ( AnalyticsPlugin , { dataLayer : window . dataLayer } ) ;
255+ Vue . use ( AnalyticsPlugin ) ;
256256
257257// Register global components
258258Vue . component ( 'ActionLink' , ActionLink ) ;
Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ describe('useAnalytics', () => {
77 beforeEach ( ( ) => {
88 // Reset modules to get fresh composable instance
99 jest . resetModules ( ) ;
10+ Analytics . destroyInstance ( ) ;
1011
1112 // Create mock dataLayer
1213 mockDataLayer = [ ] ;
@@ -28,7 +29,6 @@ describe('useAnalytics', () => {
2829
2930 afterEach ( ( ) => {
3031 jest . restoreAllMocks ( ) ;
31- Analytics . destroyInstance ( ) ;
3232 resetIntervals = 0 ;
3333 } ) ;
3434
Original file line number Diff line number Diff line change @@ -19,7 +19,6 @@ window.WritableStream = global.WritableStream = WritableStream;
1919window . TransformStream = global . TransformStream = TransformStream ;
2020window . CountQueuingStrategy = global . CountQueuingStrategy = CountQueuingStrategy ;
2121
22- import AnalyticsPlugin from 'shared/analytics/plugin' ;
2322import { setupSchema } from 'shared/data' ;
2423import * as resources from 'shared/data/resources' ;
2524import icons from 'shared/vuetify/icons' ;
@@ -53,9 +52,6 @@ Vue.use(Vuetify, {
5352// Register kolibri-design-system plugin
5453Vue . use ( KThemePlugin ) ;
5554
56- // Register analytics plugin with plain array
57- Vue . use ( AnalyticsPlugin , { dataLayer : [ ] } ) ;
58-
5955// Register global components
6056Vue . component ( 'ActionLink' , ActionLink ) ;
6157
You can’t perform that action at this time.
0 commit comments