LINE の送信ログについて、メールチャネルの _sent データビュー のように、メッセージの送信対象となった個々の連絡先に対する配信結果を確認したい、というお問い合わせをいただくことがあります。
しかしながら、LINE メッセージにおいては個々の連絡先に対する配信結果を確認するような機能は標準として提供されておりません。
そこで、LINE メッセージ内に AMPscript の InsertData を利用することで、個々の連絡先に対する LINE の送信ログをデータエクステンションに保存することが可能になりますので、この実装方法について紹介します。
なお、この実装は LINE メッセージ送信前の AMPscript がレンダリングされる段階で処理されるため、_sent データビューなどのように送信成功や送信失敗を記録できません。
そのため、ユーザーのデバイスに LINE メッセージが受信したことを保証するものではございませんので、予めご了承ください。
1. LINE 送信ログを格納するためのデータエクステンションを用意します
(データエクステンション例)
--
データエクステンション名:LINE_Send_Log
属性1:AddressID / テキスト型 / 100 文字 / Null 可
属性2:SendDate / 日付型 / Null 可
属性3:ContactKey / テキスト型/ 254 文字 / Null 可
--
2. LINE メッセージに以下のような AMPscript を実装します
(実装例1) シンプルな実装
この実装の場合、Content Builder や Journey Builder の [購読者のプレビュー] 時にも AMPscript が実行され、LINE の送信ログに記録されてしまいます。%%[SET @addressid = LINE_ADDRESS_IDInsertData('LINE_Send_Log', 'AddressID', @addressid, 'SendDate', SystemDateToLocalDate(Now()))]%%
(実装例2) [購読者のプレビュー] 時に LINE の送信ログが記録されないようにする実装%%[if _messagecontext != 'PREVIEW' thenSET @addressid = LINE_ADDRESS_IDInsertData('LINE_Send_Log', 'AddressID', @addressid, 'SendDate', SystemDateToLocalDate(Now()))endif]%%
(実装例3) LINE_ADDRESS_ID に加え、ContactKey も記録する実装%%[if _messagecontext != 'PREVIEW' thenSET @addressid = LINE_ADDRESS_IDSET @contactkey = Lookup('_MobileLineAddressContactSubscriptionView', 'ContactKey', 'AddressID', @addressid)InsertData('LINE_Send_Log', 'AddressID', @addressid, 'SendDate', SystemDateToLocalDate(Now()), 'ContactKey', @contactkey)endif]%%※ 上記はサンプルコードとなりますので、ご要件にあわせて適宜差し替え等を行ってご活用ください
3. 上記 2. の AMPscript を実装したメッセージを LINE 送信すると、上記 1. のデータエクステンションに送信ログが格納されます
【注意点、補足】
【上記 AMPscript 実装例で利用している変数や関数に関する補足情報】
005131990

We use three kinds of cookies on our websites: required, functional, and advertising. You can choose whether functional and advertising cookies apply. Click on the different cookie categories to find out more about each category and to change the default settings.
Privacy Statement
Required cookies are necessary for basic website functionality. Some examples include: session cookies needed to transmit the website, authentication cookies, and security cookies.
Functional cookies enhance functions, performance, and services on the website. Some examples include: cookies used to analyze site traffic, cookies used for market research, and cookies used to display advertising that is not directed to a particular individual.
Advertising cookies track activity across websites in order to understand a viewer’s interests, and direct them specific marketing. Some examples include: cookies used for remarketing, or interest-based advertising.