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 init.post.php controller in an addons/[your addon]/controllers/frontend/init.post.php. I.e.
switch(Registry::get('runtime.company_id')) {
case 0: $code = 'abc'; // single store
break;
case 1: $code = 'def'; // store one
break;
....
}
Registry::get('view')->assign('store_tracking_code', $code);