LINE is to Asian mobile users what Facebook Messaging and Instagram are to US mobile users—a fast and easy way to communicate with friends and discover new promotions about favorite products and services. LINE is the number one mobile messaging platform in Japan and Taiwan and one of the largest advertising delivery platforms.
LINE Conversion API (LINE CAPI) is the solution provided by LINE to collect conversion data from websites or mobile apps without relying on cookies. Using the LINE Conversion API, user information and event data can be sent directly from the advertiser's server to LINE's server.
This integration can help reduce the development cost of integrating data between clients and LINE, which should help win more sales deals and minimize the onboarding duration.
- Export events data from Treasure Data to a LINE tagId.
- Basic knowledge of Treasure Data.
- Basic knowledge LINE Ads and LINE Offline Conversions.
- Official LINE Ads account or Business Manager.
If your security policy requires IP whitelisting, you must add Treasure Data's IP addresses to your allowlist to ensure a successful connection.
Please find the complete list of static IP addresses, organized by region, at the following link:
https://api-docs.treasuredata.com/en/overview/ip-addresses-integrations-result-workers/
You must create and configure the data connection in the Treasure Data console before running the query to export data. You provide authentication credentials to access the integration as part of the data connection.
Create a new LINE Conversion Authentication
- Open TD Console.
- Navigate to Integrations Hub > Catalog.
- Search for LINE and select LINE Conversion API.
- Select Create Authentication.
- Enter the LINE Tag ID that will be used to send events.
- Enter the Access Token that will be used to authenticate to your LINE account.
- (Optional) Enter LINE Channel ID that issued the LINE User ID.
- Select Continue.
- Enter a name for your connection.
- Select Done.
Navigate to Data Workbench > Queries.
You can create or reuse a query. In the query, configure the data connection. You need to define the column mapping in the query. The columns in the query represent Event data to be uploaded into LINE.
| Column name | Data type | Required | HashingRequired | Validation | Description |
|---|---|---|---|---|---|
| referrer | string | No | No | [0..2048] characters | Specify the referrer URL of the browser when the event occurred. |
| ip_address | string | No | No | IPv4 or IPv6 addresses | Specify the IP address of the end user who raised the event. |
| title | string | No | No | [0..1024] characters | Specify the browser title of the web page when the event occurred. |
user_agent | string | No | No | Specify the browser's user agent when the event occurred. | |
url | string | No | No | ^http(s)?://.+ [0..2048] characters | Specify the URL of the browser when the event occurred. |
| deduplication_key | string | Yes | No | ^[0-9a-zA-Z-_]{1,256}$ | Specify a unique key for each event. This field deduplicates conversions sent via Conversion API and LINE Tag. |
| event_type | string | Yes | No | Only allow 'page_view' or 'conversion' | Specify the event type. |
| event_name | string | No | No | ^[A-Za-z0- 9_-]{1,20}$ | Specify the conversion event name. Specify "Conversion" to this field to measure the default conversion. Specify a custom event you defined if you want to measure custom conversions. |
source_type | string | Yes | No | Only allow 'web' | Specify the source type where the event occurred. |
event_timestamp | long | Yes | No | positive long number | Specify the time when the event occurred in UNIX time. |
| browser_id | string | No | No | ^[0-9a-fA-F]{8}-([0-9a-fA-F]{4}-){3}[0-9a-fA-F]{12}$ | Specify an ID to identify the browser of the user who raised the event uniquely. This is a unique ID issued as a cookie by the LINE Tag installed on your website. To enable measurement with a browser ID, you must enable measurement with a first-party cookie in advance. The browser ID issued by LINE Tag is given as the value of the first-party cookie keyed by __lt__cid. When sending via Conversion API, send without hashing. |
click_id | string | No | No | ^[a-zA-Z0-9- _]+$ | Specify an ID to uniquely identify a click a user brings about via LINE Ads. Conversions will be attributed to the ad specified by click_id. - Click ID is the value in the landing page URL path parameter ldtag_cl when you click on a LINE Ad. - Example: In https://example.com/foo?ldtag_cl=xxx, the value of xxx must be sent as click_id. When sending via Conversion API, please send without hashing. |
phone | string | No | Yes | Can be one of 2 formats: 1. The hashing 256 format (64 characters max length) ^[0-9a-f]{64} 2. The raw phone number with country code. ex: +818012345678 | Specify the raw or hashed phone number of the user who raised the event. |
ifa | string | No | No | ^[0-9a-fA-F]{8}-([0-9a-fA-F]{4}-){3}[0-9a-fA-F]{12}$ | Specify the IDFA or AAID value of the user who raised the event. |
| external_id | string | No | No | ^[0-9a-zA-Z-_]{1,512}$ | Specify external_id, a string that uniquely identifies a user on your system who has raised the event. |
| line_uid | string | No | No | ^U[0-9a-f]{32}$ | Specify the LINE User ID that identifies the user who raised the event. |
email | string | No | No | Can be one of 2 format: 1. The hashing 256 format (64 characters max length) ^[0-9a-f]{64}$ 2. The raw email address. Email RegEx: **^[a-zA-Z0-9_!#$%&'*+/=?`{ | }~^.-]+@[a-zA-Z0-9.-]+** |
From Treasure Data, run the following query with export results into a connection for LINE Conversion:
- Regular SELECT query from a table
SELECT
a_dedup_key_column AS deduplication_key,
an_event_type_column AS event_type,
a_source_type_column AS source_type,
a_long_column AS event_timestamp,
a_phone_column AS phone,
an_email_column AS email
FROM your_table;- Query
custom_datacolumn
SELECT
'elizabetho@fb.com' as email,
'Purchase' as event_name,
1598531676 as event_timestamp,
'dedup_key_123' as deduplication_key- Select Export Results.

- To export the results, you can use an existing authentication or create a new one. Choose either one of the following:
- Use Existing Integration
- Create New Integration
- Select Use Existing Integration.
- Select the existing integration you want to use. This example uses line_capi_output_test.

- Enter the information in the form.
4. Select Done.
| Field | Description |
|---|---|
| Ignore Invalid Records | When this flag is enabled, any invalid record is ignored and the processing flow continues. Default: true |
| Batch Size | The number of events in each batch to submit to LINE Conversion API. Default is 1000, Min: 1000, Max: 100000. |
- Select Create New Integration.
- From the Type drop-down, select LINE Conversion API.

Enter the name of the new integration.

Enter the remaining information in the form.
Select Next.
Enter the information in the Export Results form.

Select Done.
| Field | Description |
|---|---|
| LINE Tag ID | (Required) Specify the LINE Tag ID you want to use for conversion measurement with Conversion API. |
| Access Token | (Required) Specify the access token for Conversion API issued by LINE Business Manager. |
| LINE Channel ID | (Optional) Specify the LINE channel ID. |
| Maximum Retry | (Optional) Number of retries before the system gives up. Default: 8, Min: 1, Max: 10. |
| Seconds to Wait For First Retry | (Optional) The time, in seconds, between the first and second attempt. Default: 15, Min: 1, Max: 30 |
| Seconds for Max Retry Wait | (Optional) The time, in seconds, between the second and all subsequent attempts. Default: 3600, Min: 100, Max: 7200. |
| Seconds for Connection Timeout | (Optional) The time, in seconds, is to wait until an HTTP call operation is aborted. Default is 300, Min: 10, Max: 600. |
| Ignore Invalid Records | (Optional) When this flag is enabled, if a specific record has any invalid field value, then the invalid record will be ignored, and the processing flow continue. Default: true |
| Batch Size | (Optional) The number of events in each batch to submit to LINE Conversion API. Default is 1000, Min: 1000, Max: 100000. |
select referrer, ip_address, title, user_agent, url, deduplication_key, event_type,
event_name, source_type, event_timestamp, browser_id, click_id, phone, ifa,
external_id, line_uid, email
from line_capi_tbl
select * from line_capi_tblYou can use Scheduled Jobs with Result Export to periodically write the output result to a target destination that you specify.
Treasure Data's scheduler feature supports periodic query execution to achieve high availability.
When two specifications provide conflicting schedule specifications, the specification requesting to execute more often is followed while the other schedule specification is ignored.
For example, if the cron schedule is '0 0 1 * 1', then the 'day of month' specification and 'day of week' are discordant because the former specification requires it to run every first day of each month at midnight (00:00), while the latter specification requires it to run every Monday at midnight (00:00). The latter specification is followed.
Navigate to Data Workbench > Queries
Create a new query or select an existing query.
Next to Schedule, select None.

In the drop-down, select one of the following schedule options:

Drop-down Value Description Custom cron... Review Custom cron... details. @daily (midnight) Run once a day at midnight (00:00 am) in the specified time zone. @hourly (:00) Run every hour at 00 minutes. None No schedule.

| Cron Value | Description |
|---|---|
0 * * * * | Run once an hour. |
0 0 * * * | Run once a day at midnight. |
0 0 1 * * | Run once a month at midnight on the morning of the first day of the month. |
| "" | Create a job that has no scheduled run time. |
* * * * *
- - - - -
| | | | |
| | | | +----- day of week (0 - 6) (Sunday=0)
| | | +---------- month (1 - 12)
| | +--------------- day of month (1 - 31)
| +-------------------- hour (0 - 23)
+------------------------- min (0 - 59)The following named entries can be used:
- Day of Week: sun, mon, tue, wed, thu, fri, sat.
- Month: jan, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, dec.
A single space is required between each field. The values for each field can be composed of:
| Field Value | Example | Example Description |
|---|---|---|
| A single value, within the limits displayed above for each field. | ||
A wildcard '*' to indicate no restriction based on the field. | '0 0 1 * *' | Configures the schedule to run at midnight (00:00) on the first day of each month. |
A range '2-5', indicating the range of accepted values for the field. | '0 0 1-10 * *' | Configures the schedule to run at midnight (00:00) on the first 10 days of each month. |
A list of comma-separated values '2,3,4,5', indicating the list of accepted values for the field. | 0 0 1,11,21 * *' | Configures the schedule to run at midnight (00:00) every 1st, 11th, and 21st day of each month. |
A periodicity indicator '*/5' to express how often based on the field's valid range of values a schedule is allowed to run. | '30 */2 1 * *' | Configures the schedule to run on the 1st of every month, every 2 hours starting at 00:30. '0 0 */5 * *' configures the schedule to run at midnight (00:00) every 5 days starting on the 5th of each month. |
A comma-separated list of any of the above except the '*' wildcard is also supported '2,*/5,8-10'. | '0 0 5,*/10,25 * *' | Configures the schedule to run at midnight (00:00) every 5th, 10th, 20th, and 25th day of each month. |
- (Optional) You can delay the start time of a query by enabling the Delay execution.
Save the query with a name and run, or just run the query. Upon successful completion of the query, the query result is automatically exported to the specified destination.
Scheduled jobs that continuously fail due to configuration errors may be disabled on the system side after several notifications.
(Optional) You can delay the start time of a query by enabling the Delay execution.
You can also send segment data to the target platform by creating an activation in the Audience Studio.
- Navigate to Audience Studio.
- Select a parent segment.
- Open the target segment, right-mouse click, and then select Create Activation.
- In the Details panel, enter an Activation name and configure the activation according to the previous section on Configuration Parameters.
- Customize the activation output in the Output Mapping panel.

- Attribute Columns
- Select Export All Columns to export all columns without making any changes.
- Select + Add Columns to add specific columns for the export. The Output Column Name pre-populates with the same Source column name. You can update the Output Column Name. Continue to select + Add Columnsto add new columns for your activation output.
- String Builder
- + Add string to create strings for export. Select from the following values:
- String: Choose any value; use text to create a custom value.
- Timestamp: The date and time of the export.
- Segment Id: The segment ID number.
- Segment Name: The segment name.
- Audience Id: The parent segment number.
- + Add string to create strings for export. Select from the following values:
- Set a Schedule.

- Select the values to define your schedule and optionally include email notifications.
- Select Create.
If you need to create an activation for a batch journey, review Creating a Batch Journey Activation.
You can specify using this data integration to export data within Treasure Workflow.
Learn more at Using Workflows to Export Data with the TD Toolbelt.
_export:
td:
database: td.database
+line_messaging_export_task:
td>: export_line_messaging.sql
database: ${td.database}
result_connection: {your_connection_name}
result_settings:
line_tag_id: tag_id_1234
access_token: abc1234
ignore_invalid_records: trueYou can also use the CLI provided by TD Toolbelt to export query results to LINE conversion.
Using the td query command, you would specify the LINE conversion server URL with the --result RESULT_URL option. See td query for more information.
The format of the option is JSON, and the general structure is as follows.
Parameters
| Name | Description | Value | Default Value | Min Value | Max Value | Required |
|---|---|---|---|---|---|---|
| type | Describe the name of the service as the destination of export. | line_conversion | Yes | |||
| access_token | Specify the access token for Conversion API issued by LINE Business Manager. | Yes | ||||
| line_tag_id | Specify the LINE Tag ID for conversion measurement with Conversion API. | Yes | ||||
| line_channel_id | Specify LINE channel ID | No | ||||
| ignore_invalid_records | Specify this flag to skip invalid records and continue processing flow | true/false | true | No | ||
| max_records | The number of events in each batch to submit to LINE Conversion API | 1000 | 1000 | 100000 | No | |
| max_retry | Maximum number of retries when request failed | 8 | 1 | 10 | No | |
| initial_retry_wait | The initial amount of time before the first retry in seconds | 15 | 1 | 30 | No | |
| max_retry_wait | The maximum amount of time to wait for a retry in seconds | 3600 | 100 | 7200 | No | |
| connection_timeout | The HTTP connection time out for a request to Pardot in seconds | 300 | 10 | 600 | No |
To use LINE Conversion API, we need two different accounts as follows:
- LINE business manager
- LINE Ads account


After login, select Line Tag on the left menu in Business Manager page.

A list of available tags are displayed.

Select a specific tag and select the tab Conversion API.

Select the Issue access token to generate a new token for this tag.
