Adwords Tracking Code For Multiple Stores


In CS Cart docs they say to create the order_confirmation.override.tpl

and add needed code for tracking. This works for one store.

But what if I need to add codes for several stores? (in case the design is shared)

Will it work correct as follows?:

{if store_id == 1}

Tracking code 1

{elseif store_id == 2}

Tracking code 2


Tracking code 3


Or it is better to add tracking code directly to the block of landing page for each store?

You can do it in an html/smarty block manually or you can do it dynamically via

{if $runtime.company_id == 0}
// single store tracking code 
{elseif $runtime.company_id == 1}
// store 1

Alternatively you can set the tracking code you want to use in a template variable via an controller in an addons/[your addon]/controllers/frontend/ I.e.

switch(Registry::get('runtime.company_id')) {
  case 0: $code = 'abc'; // single store
  case 1: $code = 'def'; // store one
Registry::get('view')->assign('store_tracking_code', $code);

And it can then be referenced in tpl files as:


Thank you for the complete answer.