@@ -212,7 +212,7 @@ public function trackEvent($category, $action, $label = null, $value = null)
212212 *
213213 * @return AnalyticsProviderInterface
214214 */
215- public function ecommerceAddTransaction ($ id , $ affiliation = null , $ revenue = null , $ shipping = null , $ tax = null )
215+ public function ecommerceAddTransaction ($ id , $ affiliation = null , $ revenue = null , $ shipping = null , $ tax = null , $ currency = null )
216216 {
217217 // Call to enable ecommerce tracking automatically
218218 $ this ->enableEcommerceTracking ();
@@ -235,6 +235,10 @@ public function ecommerceAddTransaction($id, $affiliation = null, $revenue = nul
235235 $ parameters ['tax ' ] = $ tax ;
236236 }
237237
238+ if (!is_null ($ currency )) {
239+ $ parameters ['currency ' ] = $ currency ;
240+ }
241+
238242 $ jsonParameters = json_encode ($ parameters );
239243 $ trackingCode = "ga('ecommerce:addTransaction', {$ jsonParameters }); " ;
240244
@@ -255,7 +259,7 @@ public function ecommerceAddTransaction($id, $affiliation = null, $revenue = nul
255259 *
256260 * @return AnalyticsProviderInterface
257261 */
258- public function ecommerceAddItem ($ id , $ name , $ sku = null , $ category = null , $ price = null , $ quantity = null )
262+ public function ecommerceAddItem ($ id , $ name , $ sku = null , $ category = null , $ price = null , $ quantity = null , $ currency = null )
259263 {
260264 // Call to enable ecommerce tracking automatically
261265 $ this ->enableEcommerceTracking ();
@@ -281,6 +285,10 @@ public function ecommerceAddItem($id, $name, $sku = null, $category = null, $pri
281285 $ parameters ['quantity ' ] = $ quantity ;
282286 }
283287
288+ if (!is_null ($ currency )) {
289+ $ parameters ['currency ' ] = $ currency ;
290+ }
291+
284292 $ jsonParameters = json_encode ($ parameters );
285293 $ trackingCode = "ga('ecommerce:addItem', {$ jsonParameters }); " ;
286294
0 commit comments