@@ -11,6 +11,7 @@ import Amplitude from 'amplitude-js'
11
11
import { RepositoryFactory } from '@/repositories/RepositoryFactory'
12
12
import optimizelySDK from '@optimizely/optimizely-sdk' ;
13
13
import { Auth } from 'aws-amplify' ;
14
+ import { set , event } from "vue-gtag" ;
14
15
15
16
const RecommendationsRepository = RepositoryFactory . get ( 'recommendations' )
16
17
const ProductsRepository = RepositoryFactory . get ( 'products' )
@@ -182,7 +183,7 @@ export const AnalyticsHandler = {
182
183
}
183
184
184
185
if ( this . googleAnalyticsEnabled ( ) ) {
185
- this . $gtag . set ( {
186
+ set ( {
186
187
"user_id" : user . id ,
187
188
"user_properties" : {
188
189
"age" : user . age ,
@@ -206,7 +207,7 @@ export const AnalyticsHandler = {
206
207
} )
207
208
208
209
if ( this . googleAnalyticsEnabled ( ) ) {
209
- this . $gtag . event ( "sign_up" , {
210
+ event ( "sign_up" , {
210
211
"method" : "Web"
211
212
} ) ;
212
213
}
@@ -228,7 +229,7 @@ export const AnalyticsHandler = {
228
229
} )
229
230
230
231
if ( this . googleAnalyticsEnabled ( ) ) {
231
- this . $gtag . event ( "login" , {
232
+ event ( "login" , {
232
233
"method" : "Web"
233
234
} ) ;
234
235
}
@@ -258,7 +259,7 @@ export const AnalyticsHandler = {
258
259
}
259
260
260
261
if ( this . googleAnalyticsEnabled ( ) ) {
261
- this . $gtag . event ( "exp_" + experiment . feature , {
262
+ event ( "exp_" + experiment . feature , {
262
263
"feature" : experiment . feature ,
263
264
"name" : experiment . name ,
264
265
"variation" : experiment . variationIndex
@@ -372,7 +373,7 @@ export const AnalyticsHandler = {
372
373
}
373
374
374
375
if ( this . googleAnalyticsEnabled ( ) ) {
375
- this . $gtag . event ( 'add_to_cart' , {
376
+ event ( 'add_to_cart' , {
376
377
"currency" : "USD" ,
377
378
"value" : + product . price . toFixed ( 2 ) ,
378
379
"items" : [
@@ -506,7 +507,7 @@ export const AnalyticsHandler = {
506
507
507
508
508
509
if ( this . googleAnalyticsEnabled ( ) ) {
509
- this . $gtag . event ( 'remove_from_cart' , {
510
+ event ( 'remove_from_cart' , {
510
511
"currency" : "USD" ,
511
512
"value" : + cartItem . price . toFixed ( 2 ) ,
512
513
"items" : [
@@ -651,7 +652,7 @@ export const AnalyticsHandler = {
651
652
}
652
653
653
654
if ( this . googleAnalyticsEnabled ( ) ) {
654
- this . $gtag . event ( 'view_item' , {
655
+ event ( 'view_item' , {
655
656
"currency" : "USD" ,
656
657
"value" : + product . price . toFixed ( 2 ) ,
657
658
"items" : [
@@ -749,7 +750,7 @@ export const AnalyticsHandler = {
749
750
} ) ;
750
751
}
751
752
752
- this . $gtag . event ( 'view_cart' , {
753
+ event ( 'view_cart' , {
753
754
"value" : + cartTotal . toFixed ( 2 ) ,
754
755
"currency" : "USD" ,
755
756
"items" : gaItems
@@ -836,7 +837,7 @@ export const AnalyticsHandler = {
836
837
} ) ;
837
838
}
838
839
839
- this . $gtag . event ( 'begin_checkout' , {
840
+ event ( 'begin_checkout' , {
840
841
"value" : + cartTotal . toFixed ( 2 ) ,
841
842
"currency" : "USD" ,
842
843
"items" : gaItems
@@ -971,7 +972,7 @@ export const AnalyticsHandler = {
971
972
} ) ;
972
973
}
973
974
974
- this . $gtag . event ( 'purchase' , {
975
+ event ( 'purchase' , {
975
976
"transaction_id" : order . id . toString ( ) ,
976
977
"value" : + order . total . toFixed ( 2 ) ,
977
978
"currency" : "USD" ,
@@ -1028,7 +1029,7 @@ export const AnalyticsHandler = {
1028
1029
}
1029
1030
1030
1031
if ( this . googleAnalyticsEnabled ( ) ) {
1031
- this . $gtag . event ( 'search' , {
1032
+ event ( 'search' , {
1032
1033
"search_term" : query
1033
1034
} ) ;
1034
1035
}
0 commit comments