<script>
var yaParams = {ip: "<? echo $_SERVER['REMOTE_ADDR']; ?>"}; // получаем ip
</script>
<script>
var yaParams = 'ip: <? echo $_SERVER['REMOTE_ADDR']; ?>';
console.log(yaParams);
</script>
{literal}
...
var yaParams = ip: {/literal}{strip}{$address = waRequest::getIp()}{$address}{/strip}{literal} // получаем ip
...
params:window.yaParams, // эта строка для ip
...
{/literal}