0
の割り当て:は動的に私は動的にその値の1を割り当てる、次のJavaScriptコードを持っているGAに拡張eコマーストラッカー
dataLayer.push({
'event': 'checkout',
'ecommerce': {
'checkout': {
'actionField': {'step': 1, 'option': 'Visa'},
'products': [{
'name': 'Triblend Android T-Shirt',
'id': '12345',
'price': '15.25',
'brand': 'Google',
'category': 'Apparel',
'variant': 'Gray',
'quantity': 1
}]
}
}
});
私は新しい変数を作成することによって、動的に「製品」の内容を割り当てます、最終的なコードは次のようにたいので:
{literal}
dataLayer.push({
'event': 'checkout',
'ecommerce': {
'checkout': {
'actionField': {'step': 1, 'option': 'Visa'},
'products': [
{foreach $products as $product}
{
'name': 'Triblend Android T-Shirt',
'id': '12345',
'price': '15.25',
'brand': 'Google',
'category': 'Apparel',
'variant': 'Gray',
'quantity': 1
}
{/foreach}
]
}
}
});
{/literal}
01:
dataLayer.push({
'event': 'checkout',
'ecommerce': {
'checkout': {
'actionField': {'step': 1, 'option': 'Visa'},
'products': my_new_array
}
}
});
それは次のようになりますので、私はSmartyのを使用してそれを実行しようとしました
しかし、動作しません。 これをどのように達成できますか?助けてくれてありがとう。
「機能しません」という問題が実際に役立つ説明ではない場合は、少し具体的になりますか? –