LINE Ads
LINE Ads is a real self-serve platform in Taiwan and Thailand. Its web stack is LINE Tag plus LINE Conversion API v1.
Do not use this skill for a new Japan LINE Ads account. Japan stopped new LINE Ads API applications on 2025-12-25 and new LINE Ads account applications on 2026-06-30. LINE says Japan LINE Ads ends in March 2027. Use LY Ads instead. Sources: Japan sunset notice, Japan account notice, and Japan API notice.
Account and access
Taiwan LAP
- Create a LINE Business ID and open LAP from LINE Taiwan. This is a self-serve signup path.
- Complete advertiser identity verification. Non-individual advertisers upload business registration and a signed identity authorization letter.
- Enable 2FA on the LINE Business ID. Taiwan requires 2FA before ad-account creation. See the Taiwan identity guide.
- Create the ad account and LINE Tag in Ad Manager.
- In Business Manager, issue a Conversion API token for that LINE Tag.
Thailand LINE Ads
- Create a LINE Official Account.
- Create a LINE Business ID and open LINE Ads Manager.
- Create a group and ad account. Enter payer, advertiser, product, and website information. The account enters review.
- Complete business verification and add a payment method.
- Create a LINE Tag. Issue its Conversion API token in Business Manager.
See the Thailand onboarding guide and account manual. The LINE Official Account admin must approve the ad-account link.
LINE does not define environment-variable names. Use these local adapter names:
LINE_ADS_TAG_ID LINE Tag `tagId` and API path ID
LINE_ADS_CAPI_TOKEN Business Manager Conversion API token
LINE_ADS_CHANNEL_ID Numeric LINE channel ID when sending `line_uid`
Keep the token and channel ID on the server. The tag ID is public.
Client-side LINE Tag
Get the account-specific code from Ad Manager: Reports and figures →
Tracking (LINE Tag). Put the base code in <head> on every page that needs
measurement. A tag manager is also supported. Load the base code before event
code. Use one base code from the account's tag set per page. Source: LINE Tag
manual.
This is the real loader and call shape. Copy the generated account code before deployment.
<script>
(function(g,d,o){g._ltq=g._ltq||[];g._lt=g._lt||function(){g._ltq.push(arguments)};
var h=location.protocol==='https:'?'https://d.line-scdn.net':'http://d.line-cdn.net';
var s=d.createElement('script');s.async=1;s.src=o||h+'/n/line_tag/public/release/v1/lt.js';
var t=d.getElementsByTagName('script')[0];t.parentNode.insertBefore(s,t);})(window,document);
_lt('init',{customerType:'lap',tagId:'<LINE_ADS_TAG_ID>'});
_lt('send','pv',['<LINE_ADS_TAG_ID>']);
</script>
Install the conversion code on the conversion page, after the base code:
<script>
_lt('send','cv',{type:'Purchase',value:25.00,currency:'USD'},['<LINE_ADS_TAG_ID>']);
</script>
Purchase supports value and currency for value optimisation. The standard
event guide lists the
standard event names.
Server-side Conversion API v1
POST https://conversion-api.tr.line.me/v1/{line_tag_id}/events
Content-Type: application/json
X-Line-TagAccessToken: $LINE_ADS_CAPI_TOKEN
X-Line-ChannelID: $LINE_ADS_CHANNEL_ID # only with user.line_uid
The official API reference
requires a JSON array. Each item requires event and user. Web events can
include web; standard-event value data goes in custom.
[
{
"event": {
"source_type": "web", "event_type": "conversion",
"event_name": "Purchase", "event_timestamp": 1735689600,
"deduplication_key": "payment-provider-event-id", "test_flag": false
},
"user": {
"click_id": "<ldtag_cl>", "browser_id": "<__lt__cid>",
"email": "<sha256-email>", "phone": "<sha256-phone>"
},
"web": {"url":"https://example.com/thanks", "referrer":"https://example.com/checkout",
"user_agent":"<user-agent>", "ip_address":"<client-ip>"},
"custom": {"value":25.00, "currency":"USD"}
}
]
event_timestamp uses Unix seconds. user needs at least one match field.
LINE lists line_uid, click_id, phone, email, ifa, browser_id, and
external_id. browser_id and external_id work after LINE creates mapping
data. The token must belong to the line_tag_id in the URL.
Identity and consent
Apply the hub consent gate before hashing. Normalize email as trim, lowercase, UTF-8, then SHA-256 hex. LINE's official server template uses the same rule and accepts an existing 64-character hex hash.
Do not guess phone normalisation. UNVERIFIED: the reviewed direct-API reference does not define it. Apply the region's current rule before hashing. Send no identifiers without consent. LINE discards events when matching fails or consent cannot be confirmed, and does not update Business Manager status.
For user.line_uid, send the provider's numeric channel ID in
X-Line-ChannelID. This is not a LINE Login or Messaging API token.
Canonical event mapping
The ad-conversion-hub owns canonical events. This adapter owns LINE names:
| Hub event | LINE request |
|---|---|
page_view |
event_type: "page_view"; omit event_name |
view_content |
ViewItemDetail |
lead |
GenerateLead |
signup |
CompleteRegistration |
begin_checkout |
InitiateCheckOut |
purchase |
Purchase |
subscription_start |
Custom event SubscriptionStart |
refund |
Custom event Refund |
For conversion rows, use event_type: "conversion". The last two names are
custom events, not standard events. Custom event names allow up to 20
alphanumeric characters without spaces. Create a custom conversion in Ad
Manager for attributed reporting. See the Thailand tag manual.
Deduplication
LINE uses event.deduplication_key. It compares both event_name and deduplication_key.
It deduplicates matching events that arrive within 30 days
of first acceptance. Use the hub's stable event_id for both twins. Pass it to
the browser as deduplicationKey and to the server as deduplication_key.
Do not stringify undefined or null. LINE warns that repeated undefined
values can collapse unrelated events. Do not let the official template generate
a random key when a shared key is available. Source: deduplication guidance.
Click ID and cookies
The click parameter is ldtag_cl. Capture it on the first landing request and
persist it in first-party storage. Keep first-touch and most-recent values when
needed. Send it as user.click_id. LINE's official template reads ldtag_cl
from the page URL.
The same template uses the first-party __lt__cid browser ID cookie. It sets
that cookie for two years when cookie measurement is enabled. Source: official
LINE server-tag source.
UNVERIFIED: LINE does not publish a separate ldtag_cl TTL. Use the documented
attribution window and your own first-party retention policy.
Default web attribution is 30 days after the ad press. The current Conversion API guide documents custom windows from 1 to 90 days. An older Thailand help page says 1 to 180 days. Treat the target account's Ad Manager setting as authoritative. LINE uses event acceptance time, so late delivery can miss the window. Do not gate a server purchase on a click ID.
For different root domains, use sharedCookieDomain and autoLink. This needs
first-party cookies or local storage and can fail on JavaScript-driven
navigation. Source: cross-domain guide.
Tracking quirks that break attribution
- Web and app tracking are separate. Web uses LINE Tag or Conversion API. App measurement uses mobile SDK or an MMP. Do not send app installs as web events.
test_flag: trueaccepts a test but excludes it from reporting, audiences, and optimisation. Usefalsefor production proof.- Custom events need a console custom-conversion definition before attributed reporting starts.
- Browser privacy, expired cookies, and cross-domain redirects reduce matching.
- One invalid item can discard the full JSON array. Send small validated batches.
- A 500 response can mean partial acceptance. Replay with the same key only after checking the dispatch log.
- A standard
Purchasecode and a custom event with the same name can double results. Use one.
Verification
- Send a test event with
test_flag: trueand a real match field. Record the redacted response.202means LINE received all events in the request.400rejects the request,401means an invalid token, and500can mean partial acceptance. Source: API responses. - If using LINE's GTM template, use server-container Preview. It shows the outbound request, response, event data, and error logs.
- Send a production event with
test_flag: false. Check Tracking (LINE Tag) status and the relevant conversion or standard-event report column. - Reconcile attributed events with payment-provider succeeded charges. Store status, canonical event ID, LINE event name, and retry count in the hub log.
Common pitfalls
- Using a tag ID from another account, or a token not associated with that tag.
- Using a LINE Login or Messaging API token in
X-Line-TagAccessToken. - Sending
event_idinstead ofdeduplication_key. - Sending
Purchasein the browser andConversionon the server. - Double-hashing a 64-character identity hash.
- Sending milliseconds instead of Unix seconds.
- Blocking
ldtag_clor__lt__cidduring redirects. - Treating
202as attribution proof. It proves receipt only.
Security
Keep LINE_ADS_CAPI_TOKEN in the deployment secret store. Never place it in a
browser bundle, URL, log, screenshot, or repository. Use HTTPS.
Apply the hub consent gate before dispatch. Do not log raw email, phone, LINE user IDs, click IDs, cookies, tokens, or full request bodies. Redact identifiers and tokens in errors. Delete temporary normalized values after dispatch.