agentleFS
itsryanarmaniitsryanarmani/skills/ads-line/SKILL.md

ads-line

Skill1 starsChanged 5 days agoMITView on GitHub

Set up LINE Ads Platform (LAP) web conversion tracking in Taiwan or Thailand: self-serve advertiser access, LINE Tag, LINE Conversion API v1, ldtag_cl capture, deduplication_key pairing, consent and user matching, 30-day attribution, and server-side verification. Use when wiring LAP Purchase or GenerateLead tracking, or debugging missing LINE conversions.

1 other project uses a version of this.

Adopted by

Most recently taken up by

The file

Show its rules and text

We split this skill into the rules it gives an agent

14 rules. About 0 are common, 11 are distinctive, and 3 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈11

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 3

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Do not use this skill for a new Japan LINE Ads account.

    line 11
  2. Distinctive:

    Create a LINE Business ID and open LAP from LINE Taiwan.

    line 21
  3. Distinctive:

    Create the ad account and LINE Tag in Ad Manager.

    line 27
  4. Distinctive:

    Create a LINE Official Account.

    line 32
  5. Distinctive:

    Create a LINE Business ID and open LINE Ads Manager.

    line 33
  6. Distinctive:

    Create a group and ad account.

    line 34
  7. Distinctive:

    Create a LINE Tag. Issue its Conversion API token in Business Manager.

    line 37
  8. Distinctive:

    Keep the token and channel ID on the server.

    line 51
  9. Very specific:

    Tracking (LINE Tag): Put the base code in <head> on every page that needs measurement.

    line 56
  10. Distinctive:

    Do not guess phone normalisation.

    line 130
  11. Very specific:

    Do not stringify undefined or null.

    line 166
  12. Distinctive:

    Default web attribution is 30 days after the ad press.

    line 184
  13. Distinctive:

    If using LINE's GTM template, use server-container Preview.

    line 215
  14. Very specific:

    Keep LINE_ADS_CAPI_TOKEN in the deployment secret store.

    line 235

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

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

  1. Create a LINE Business ID and open LAP from LINE Taiwan. This is a self-serve signup path.
  2. Complete advertiser identity verification. Non-individual advertisers upload business registration and a signed identity authorization letter.
  3. Enable 2FA on the LINE Business ID. Taiwan requires 2FA before ad-account creation. See the Taiwan identity guide.
  4. Create the ad account and LINE Tag in Ad Manager.
  5. In Business Manager, issue a Conversion API token for that LINE Tag.

Thailand LINE Ads

  1. Create a LINE Official Account.
  2. Create a LINE Business ID and open LINE Ads Manager.
  3. Create a group and ad account. Enter payer, advertiser, product, and website information. The account enters review.
  4. Complete business verification and add a payment method.
  5. 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 eventLINE request
page_viewevent_type: "page_view"; omit event_name
view_contentViewItemDetail
leadGenerateLead
signupCompleteRegistration
begin_checkoutInitiateCheckOut
purchasePurchase
subscription_startCustom event SubscriptionStart
refundCustom 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: true accepts a test but excludes it from reporting, audiences, and optimisation. Use false for 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 Purchase code and a custom event with the same name can double results. Use one.

Verification

  1. Send a test event with test_flag: true and a real match field. Record the redacted response. 202 means LINE received all events in the request. 400 rejects the request, 401 means an invalid token, and 500 can mean partial acceptance. Source: API responses.
  2. If using LINE's GTM template, use server-container Preview. It shows the outbound request, response, event data, and error logs.
  3. Send a production event with test_flag: false. Check Tracking (LINE Tag) status and the relevant conversion or standard-event report column.
  4. 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_id instead of deduplication_key.
  • Sending Purchase in the browser and Conversion on the server.
  • Double-hashing a 64-character identity hash.
  • Sending milliseconds instead of Unix seconds.
  • Blocking ldtag_cl or __lt__cid during redirects.
  • Treating 202 as 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.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.