문자·알림톡에 짧은주소 넣고 클릭 추적하기
샌드고 짧은 URL 로 긴 링크를 줄이고, 누가 언제 눌렀는지 통계를 확인하는 방법. 문자 바이트 절약과 반응 측정.
POST /api/v2/short-urls문자 본문에 긴 URL 을 그대로 넣으면 두 가지 손해를 봅니다. 바이트를 잡아먹고, 누가 눌렀는지 알 수 없습니다.
[이벤트] 가을 특가! https://shop.example.com/promotions/autumn-2026?utm_source=sms&utm_campaign=autumn
→ 90바이트를 훌쩍 넘겨 LMS 로 승격되고, 반응은 측정되지 않는다.
[이벤트] 가을 특가! https://sendgo.io/s/k7Rm2xQ
→ SMS 안에 들어가고, 클릭이 집계된다.
짧은주소 만들기
POST /api/v2/short-urls
| 파라미터 | 필수 | 설명 |
|---|---|---|
targetUrl |
✅ | 원본 URL. http/https 만 허용, 최대 2,048자 |
title |
관리 화면에서 구분할 이름 | |
expiresAt |
이 시각 이후 410 Gone. Y-m-d H:i:s |
|
forceNew |
true 면 같은 URL 이어도 새 코드 발급 |
Node.js / TypeScript
const created = await sendgo.shortUrl.create({
targetUrl: 'https://shop.example.com/promotions/autumn-2026',
title: '가을 세일 랜딩',
expiresAt: '2026-09-30 23:59:59',
});
const { code, shortUrl } = created.data;
await sendgo.sms.sendSms({
content: `[이벤트] 가을 특가! ${shortUrl}`,
contacts: [{ contact: '01012345678' }],
});
Python
created = client.short_url.create(
target_url="https://shop.example.com/promotions/autumn-2026",
title="가을 세일 랜딩",
)
link = created["data"]["shortUrl"]
client.sms.send_sms(
content=f"[이벤트] 가을 특가! {link}",
contacts=[{"contact": "01012345678"}],
)
PHP
<?php
$short = $sendgo->shortUrl->create([
'targetUrl' => 'https://shop.example.com/promotions/autumn-2026',
'title' => '가을 세일 랜딩',
]);
$link = $short['data']['shortUrl'];
$sendgo->sms->sendSms([
'content' => "[이벤트] 가을 특가! {$link}",
'contacts' => [['contact' => '01012345678']],
]);
클릭 통계 조회
const stats = await sendgo.shortUrl.stats(code, { from: '2026-09-01' });
await sendgo.shortUrl.list({ count: 10 }); // 목록
await sendgo.shortUrl.show(code); // 상세
await sendgo.shortUrl.deactivate(code); // 리다이렉트 중지 (통계는 남는다)
stats = client.short_url.stats(code, from_="2026-09-01")
client.short_url.list(count=10)
client.short_url.show(code)
<?php
$stats = $sendgo->shortUrl->stats($code, ['from' => '2026-09-01']);
$sendgo->shortUrl->list(['count' => 10]);
$sendgo->shortUrl->show($code);
$sendgo->shortUrl->deactivate($code);
캠페인별로 통계 나누기
같은 랜딩 페이지를 여러 캠페인에서 쓴다면 forceNew 로 코드를 따로 발급받으세요. 그러지 않으면 통계가 한 코드에 합쳐져 어떤 캠페인이 효과가 있었는지 알 수 없습니다.
const augustLink = await sendgo.shortUrl.create({
targetUrl: 'https://shop.example.com/sale',
title: '8월 세일 - 알림톡',
forceNew: true,
});
const septemberLink = await sendgo.shortUrl.create({
targetUrl: 'https://shop.example.com/sale', // 같은 목적지
title: '9월 세일 - 문자',
forceNew: true, // 다른 코드
});
놓치기 쉬운 것
- 알림톡 템플릿에는 링크를 변수로 넣어야 합니다. 템플릿 본문에 URL 을 고정하면 캠페인마다 재심사를 받아야 합니다.
#{var3}자리에 짧은주소를 넣으세요. - 만료 시각을 정하세요. 지난 이벤트 링크가 계속 살아 있으면 뒤늦게 눌린 사용자가 종료된 페이지를 봅니다.
- 짧은주소를 사이트맵에 넣지 마세요. 추측 불가능한 코드가 곧 접근 통제인 경우가 있습니다.
다음 단계
자주 묻는 질문
- 짧은주소를 왜 써야 하나요?
- 두 가지 이유입니다. 첫째, SMS 는 90바이트 제한이 있어 긴 URL 하나가 본문의 절반을 먹습니다. 둘째, 원본 링크를 그대로 넣으면 누가 눌렀는지 알 수 없지만 짧은주소는 클릭 통계가 남습니다.
- 만든 짧은주소를 나중에 막을 수 있나요?
- deactivate 로 리다이렉트를 중지할 수 있습니다. 통계는 남으므로 과거 반응 데이터는 그대로 조회됩니다. 만료 시각(expiresAt)을 미리 지정해 두면 그 이후에는 410 Gone 을 반환합니다.
- 같은 URL 을 여러 번 요청하면 매번 새 코드가 생기나요?
- 기본적으로는 기존 코드를 재사용합니다. 캠페인별로 통계를 분리하고 싶다면 forceNew 를 true 로 지정해 새 코드를 발급받으세요.