FROM CACHE - jp_header

タグでリピーターか新規ユーザーかでの出し分けは可能でしょうか?

oshiro
訪問者
1 0 0

CVページにて下記コードを記述しているのですが、
"code"のa8の部分をリピーターか新規ユーザーかでの出し分けは可能でしょうか?

{% if first_time_accessed %}

<span id="a8sales"></span>
<script src="//statics.a8.net/a8sales/a8sales.js"></script>
<script>
a8sales({
"pid": "s00000021716001",
"order_number": "{{ order_number }}",
"currency": "{{ shop.currency }}",
"items": [
{
"code": "a8",
"price": {{ checkout.subtotal_price | money_without_currency | remove: ',' }},
"quantity": 1
},
],
"total_price": {{ checkout.subtotal_price | money_without_currency | remove: ',' }}
});
</script>

{% endif %}

1件の返信1

junichiokamura
Community Manager
1200 280 506

{% if first_time_accessed %}  が、初回訪問者かどうかの判定なので、この場合、このコード自体が、初回訪問の時のみしか挿入されません。

コード自体は毎回挿入して、codeを、初回かどうかで変えるのであれば、こんな感じになると思います。

 

<span id="a8sales"></span>
<script src="//statics.a8.net/a8sales/a8sales.js"></script>
<script>
a8sales({
"pid": "s00000021716001",
"order_number": "{{ order_number }}",
"currency": "{{ shop.currency }}",
"items": [
{

{% if first_time_accessed %}
"code": "a8",     // 初回のコード

{% else %}

"code": "xxxx",     // その他のコード

{% endif %}
"price": {{ checkout.subtotal_price | money_without_currency | remove: ',' }},
"quantity": 1
},
],
"total_price": {{ checkout.subtotal_price | money_without_currency | remove: ',' }}
});
</script>

 

 

Senior Partner Solutions Engineer