@@ -15,7 +15,7 @@ export class GoogleTransport extends BaseTransport<GoogleTransportConfig> {
1515
1616 await this . trackEvent ( {
1717 ...this . transportConfig . categoryActionMap . whisperDisplayed ,
18- label : isUpdated ? 'Updated ' : 'Created' ,
18+ label : ` ${ name } , ${ isUpdated ? 'updated ' : 'created' } ` ,
1919 } ) ;
2020 }
2121
@@ -44,14 +44,12 @@ export class GoogleTransport extends BaseTransport<GoogleTransportConfig> {
4444 await GoogleTransport . send ( this . buildRequest ( HitType . Event , props ) ) ;
4545 }
4646
47- private buildRequest ( hitType : HitType , props ?: EventProps ) {
47+ protected buildRequest ( hitType : HitType , props ?: EventProps ) {
4848 return {
4949 method : 'POST' ,
5050 url : this . baseUrl ,
5151 headers : {
52- 'User-Agent' : [
53- `OliveHelps @oliveai/loop-analytics ${ this . loopConfig . name . replace ( / / g, '' ) } ` ,
54- ] ,
52+ 'User-Agent' : [ this . transportConfig . userAgent ] , // Required by GA
5553 } ,
5654 body : this . buildRequestBody ( hitType , props ) ,
5755 } ;
@@ -71,12 +69,12 @@ export class GoogleTransport extends BaseTransport<GoogleTransportConfig> {
7169 t : hitType ,
7270 dh : this . loopConfig . name ,
7371 dp : `/${ this . loopConfig . name } /${ this . currentWhisperName } ` ,
74- dt : this . currentWhisperName || '' ,
72+ dt : this . currentWhisperName ?? '' ,
7573 } ;
7674 if ( hitType === HitType . Event && props ) {
7775 propStringObj . ec = props . category ;
7876 propStringObj . ea = props . action ;
79- propStringObj . el = props . label ;
77+ propStringObj . el = props . label ?? '' ;
8078 }
8179 customDimensions ?. forEach ( ( { index, value } ) => {
8280 propStringObj [ `cd${ index } ` ] = value ;
@@ -86,6 +84,7 @@ export class GoogleTransport extends BaseTransport<GoogleTransportConfig> {
8684 } ) ;
8785
8886 return Object . entries ( propStringObj )
87+ . filter ( ( [ , value ] ) => ! ! value )
8988 . map ( ( [ key , value ] ) => `${ key } =${ encodeURIComponent ( value ) } ` )
9089 . join ( '&' ) ;
9190 }
0 commit comments