@@ -8,6 +8,7 @@ import { RCData } from "../rc";
8
8
import { Config } from "../config" ;
9
9
import { FirebaseConfig } from "../firebaseConfig" ;
10
10
import { Options } from "../options" ;
11
+ import { trackGA4 } from "../track" ;
11
12
12
13
export interface Setup {
13
14
config : FirebaseConfig ;
@@ -93,6 +94,8 @@ const featureMap = new Map(featuresList.map((feature) => [feature.name, feature]
93
94
export async function init ( setup : Setup , config : Config , options : any ) : Promise < any > {
94
95
const nextFeature = setup . features ?. shift ( ) ;
95
96
if ( nextFeature ) {
97
+ const start = process . uptime ( ) ;
98
+
96
99
const f = featureMap . get ( nextFeature ) ;
97
100
if ( ! f ) {
98
101
const availableFeatures = Object . keys ( features )
@@ -120,13 +123,20 @@ export async function init(setup: Setup, config: Config, options: any): Promise<
120
123
if ( f . postSetup ) {
121
124
await f . postSetup ( setup , config , options ) ;
122
125
}
126
+
127
+ const duration = Math . floor ( ( process . uptime ( ) - start ) * 1000 ) ;
128
+ await trackGA4 ( "product_init" , { feature : nextFeature } , duration ) ;
129
+
123
130
return init ( setup , config , options ) ;
124
131
}
125
132
}
126
133
134
+ /** Actuate the feature init flow from firebase_init MCP tool. */
127
135
export async function actuate ( setup : Setup , config : Config , options : any ) : Promise < any > {
128
136
const nextFeature = setup . features ?. shift ( ) ;
129
137
if ( nextFeature ) {
138
+ const start = process . uptime ( ) ;
139
+
130
140
const f = lookupFeature ( nextFeature ) ;
131
141
logger . info ( clc . bold ( `\n${ clc . white ( "===" ) } ${ capitalize ( nextFeature ) } Setup Actuation` ) ) ;
132
142
@@ -139,6 +149,10 @@ export async function actuate(setup: Setup, config: Config, options: any): Promi
139
149
await f . actuate ( setup , config , options ) ;
140
150
}
141
151
}
152
+
153
+ const duration = Math . floor ( ( process . uptime ( ) - start ) * 1000 ) ;
154
+ await trackGA4 ( "product_init_mcp" , { feature : nextFeature } , duration ) ;
155
+
142
156
return actuate ( setup , config , options ) ;
143
157
}
144
158
}
0 commit comments