@@ -86,7 +86,22 @@ public function generate(string $storeId = null): array
8686 ],
8787 'tag ' => $ isAnalyticsEnabled ? $ this ->generateTags ($ accountId , $ containerId , $ timestamp , $ storeId ) : [],
8888 'trigger ' => $ isAnalyticsEnabled ? $ this ->generateTriggers ($ accountId , $ containerId , $ timestamp ) : [],
89- 'variable ' => [],
89+ 'variable ' => [
90+ [
91+ 'accountId ' => $ accountId ,
92+ 'containerId ' => $ containerId ,
93+ 'variableId ' => '692 ' ,
94+ 'name ' => 'Magefan Constant Measurement ID ' ,
95+ 'type ' => 'c ' ,
96+ 'parameter ' => [
97+ [
98+ 'type ' => 'TEMPLATE ' ,
99+ 'key ' => 'value ' ,
100+ 'value ' => $ this ->config ->getMeasurementId ($ storeId )
101+ ],
102+ ]
103+ ]
104+ ],
90105 'builtInVariable ' => $ isAnalyticsEnabled ? [
91106 [
92107 'accountId ' => $ accountId ,
@@ -200,22 +215,33 @@ private function generateTags(
200215 'containerId ' => $ containerId ,
201216 'tagId ' => '163 ' ,
202217 'name ' => 'Magefan GA4 - Configuration ' ,
203- 'type ' => 'gaawc ' ,
218+ 'type ' => 'googtag ' ,
204219 'parameter ' => [
205220 [
206- 'type ' => 'BOOLEAN ' ,
207- 'key ' => 'sendPageView ' ,
208- 'value ' => 'true '
209- ],
210- [
211- 'type ' => 'BOOLEAN ' ,
212- 'key ' => 'enableSendToServerContainer ' ,
213- 'value ' => 'false '
221+ 'type ' => 'TEMPLATE ' ,
222+ 'key ' => 'tagId ' ,
223+ 'value ' => '{{Magefan Constant Measurement ID}} '
214224 ],
215225 [
216- 'type ' => 'TEMPLATE ' ,
217- 'key ' => 'measurementId ' ,
218- 'value ' => $ this ->config ->getMeasurementId ($ storeId )
226+ 'type ' => 'LIST ' ,
227+ 'key ' => 'configSettingsTable ' ,
228+ 'list ' => [
229+ [
230+ 'type ' => 'MAP ' ,
231+ 'map ' => [
232+ [
233+ 'type ' => 'TEMPLATE ' ,
234+ 'key ' => 'parameter ' ,
235+ 'value ' => 'send_page_view '
236+ ],
237+ [
238+ 'type ' => 'TEMPLATE ' ,
239+ 'key ' => 'parameterValue ' ,
240+ 'value ' => 'true '
241+ ]
242+ ]
243+ ]
244+ ]
219245 ]
220246 ],
221247 'fingerprint ' => $ timestamp ,
@@ -253,9 +279,9 @@ private function generateTags(
253279 'value ' => '{{Event}} '
254280 ],
255281 [
256- 'type ' => 'TAG_REFERENCE ' ,
257- 'key ' => 'measurementId ' ,
258- 'value ' => 'Magefan GA4 - Configuration '
282+ 'type ' => 'TEMPLATE ' ,
283+ 'key ' => 'measurementIdOverride ' ,
284+ 'value ' => '{{ Magefan Constant Measurement ID}} '
259285 ]
260286 ],
261287 'fingerprint ' => $ timestamp ,
0 commit comments