icon picker
마켓몰 GA4

주문 완료 Complete.jsp

rtnData
transaction_id: orderM.ordId (거래 ID)
value: orderPayInfo.normalSlAmt(총 상품가격)
currency: KRW (통화)
items: orderList (구매 상품 리스트)t
item_id: webPrdId (상품 ID)
item_name: webPrdNm (상품명)
price: slPc (상품 정가)
quantity: ordQty (상품 개수)
tax: orderPayInfo.pnPayAmt(마일리지 + 상품권 결제) + orderPayInfo.ordPrdDsnAmt (쿠폰 총 할인 금액)
shipping: orderPayInfo.dlvfAmt (총 배송비)
coupon

실수 → 정수형 포맷팅

<fmt:parseNumber var="value" value="${rtnData.orderPayInfo.normalSlAmt}" integerOnly="true" />

Purchase 이벤트 parameter 정보 출력

<div style="display: flex; flex-direction: column; justify-content:center; align-items: center; margin-top: 10px;">
<h4>Purchase 이벤트 내용</h4>
<div style="flex-direction: row">
<div>
<p>transaction_id: ${rtnData.orderM.ordId}</p>
</div>
<div>
<fmt:parseNumber var="value" value="${rtnData.orderPayInfo.normalSlAmt}" integerOnly="true" />
<p>value: ${value}</p>
</div>
<div>
<p>currency: KRW</p>
</div>
<div>
<fmt:parseNumber var="tax" value="${rtnData.orderPayInfo.pnPayAmt + rtnData.orderPayInfo.ordPrdDsnAmt}" integerOnly="true" />
<p>tax: ${tax}</p>
</div>
<div>
<fmt:parseNumber var="shipping" value="${rtnData.orderPayInfo.dlvfAmt}" integerOnly="true" />
<p>shipping: ${shipping}</p>
</div>
<div>
items
</div>
<table style="border: 1px solid grey; margin: 5px">
<thead>
<tr>
<th>item_id</th>
<th>item_name</th>
<th>price</th>
<th>quantity</th>
</tr>
</thead>
<tbody style="text-align: center">
<c:forEach var="item" items="${rtnData.orderList}">
<fmt:parseNumber var="price" value="${item.slPc}" integerOnly="true" />
<tr>
<td>${item.webPrdId}</td>
<td>${item.webPrdNm}</td>
<td>${price}</td>
<td>${item.ordQty}</td>
</tr>
</c:forEach>
</tbody>
</table>
</div>
</div>

결과 화면

image.png

Gtag Purchase Event 삽입

<%-- Gtag Purchase Event 삽입 --%>
<script>
var items = []
<c:forEach var="data" items="${rtnData.orderList}">
<fmt:parseNumber var="price" value="${data.slPc}" integerOnly="true" />
items.push({
webPrdId: `${data.webPrdId}`,
webPrdNm: `${data.webPrdNm}`,
price: Number(`${price}`),
quantity: Number(`${data.ordQty}`)
})
</c:forEach>

<fmt:parseNumber var="value" value="${rtnData.orderPayInfo.normalSlAmt}" integerOnly="true" />
<fmt:parseNumber var="tax" value="${rtnData.orderPayInfo.pnPayAmt + rtnData.orderPayInfo.ordPrdDsnAmt}" integerOnly="true" />
<fmt:parseNumber var="shipping" value="${rtnData.orderPayInfo.dlvfAmt}" integerOnly="true" />

var purchase_info = {
transaction_id: `T_${rtnData.orderM.ordId}`,
value: Number(`${value}`),
currency: 'KRW',
items: items,
tax: Number(`${tax}`),
shipping: Number(`${shipping}`),
}
gtag("event", "purchase", {
transaction_id: `T_${rtnData.orderM.ordId}`,
value: Number(`${value}`),
currency: 'KRW',
items: items,
tax: Number(`${tax}`),
shipping: Number(`${shipping}`)
})

console.log(purchase_info)
</script>

Purchase 시 결제 정보 및 애널리틱스 데이터 확인

image.png
image.png

Want to print your doc?
This is not the way.
Try clicking the ⋯ next to your doc name or using a keyboard shortcut (
CtrlP
) instead.