본문으로 건너뛰기
딥 링킹 · · 5분 소요

딥 링크 파라미터: 링크로 데이터 전달하기

작성자 Tolinku 팀
|
딥 링크 파라미터: 링크로 데이터 전달하기

앱을 여는 딥 링크도 쓸모는 있어요. 하지만 앱을 열고, 알맞은 상품으로 이동하고, 할인 코드를 적용하고, 방문을 올바른 캠페인에 어트리뷰션하는 딥 링크는 훨씬 강력해요. 차이는 파라미터에 있어요. 앱이 도착했을 때 읽는, URL에 인코딩된 데이터예요.

이 가이드에서는 딥 링크로 파라미터를 전달하고 처리하는 방법을 다뤄요. 라우팅은 딥 링크 라우팅: 사용자를 올바른 화면으로 보내는 방법. 컨텍스트 딥 링킹은 컨텍스트 딥 링킹: 설치 과정으로 데이터 전달.

링크 유형, 경로, 동작 설정이 있는 Tolinku 라우트 생성 폼 기본, 동작, 고급 설정 섹션이 있는 라우트 생성 폼.

파라미터 종류

경로 파라미터

URL 경로에 담긴 데이터:

https://app.example.com/products/abc123
                                 ^^^^^^
                                 경로 파라미터: productId = "abc123"

https://app.example.com/users/jane/posts/42
                              ^^^^       ^^
                              userId     postId

경로 파라미터는 리소스를 식별할 때 가장 적합해요. 어떤 상품인지, 어떤 사용자인지, 어떤 게시물인지를 가리키는 값이죠.

쿼리 파라미터

URL에서 ? 뒤에 오는 데이터:

https://app.example.com/products/abc123?ref=email&campaign=summer&discount=SAVE20
                                        ^^^       ^^^^^^^^        ^^^^^^^^
                                        출처      캠페인          프로모션 코드

쿼리 파라미터는 메타데이터에 가장 적합해요. 추적, 설정, 선택적 옵션이 여기에 해당해요.

프래그먼트 파라미터

URL에서 #:

https://app.example.com/docs/guide#section-3
                                   ^^^^^^^^^
                                   해당 섹션으로 스크롤

프래그먼트는 서버로 전송되지 않아서 딥 링크에서는 거의 쓰지 않아요. 페이지 안에서 클라이언트 측 이동을 할 때만 사용하세요.

파라미터 파싱

iOS (Swift)

func parseDeepLink(_ url: URL) -> DeepLinkData? {
    guard let components = URLComponents(url: url, resolvingAgainstBaseURL: false) else {
        return nil
    }

    // 경로 파라미터
    let pathComponents = components.path
        .split(separator: "/")
        .map(String.init)

    // 쿼리 파라미터
    let queryItems = components.queryItems ?? []
    let queryDict = Dictionary(
        uniqueKeysWithValues: queryItems.compactMap { item in
            item.value.map { (item.name, $0) }
        }
    )

    // 예시: /products/abc123?ref=email
    if pathComponents.first == "products", let productId = pathComponents.dropFirst().first {
        return DeepLinkData(
            screen: .product(id: String(productId)),
            source: queryDict["ref"],
            campaign: queryDict["campaign"],
            discountCode: queryDict["discount"]
        )
    }

    return nil
}

Android (Kotlin)

fun parseDeepLink(uri: Uri): DeepLinkData? {
    // 경로 파라미터
    val pathSegments = uri.pathSegments

    // 쿼리 파라미터
    val ref = uri.getQueryParameter("ref")
    val campaign = uri.getQueryParameter("campaign")
    val discount = uri.getQueryParameter("discount")

    // 예시: /products/abc123?ref=email
    if (pathSegments.firstOrNull() == "products" && pathSegments.size >= 2) {
        val productId = pathSegments[1]
        return DeepLinkData(
            screen = Screen.Product(productId),
            source = ref,
            campaign = campaign,
            discountCode = discount
        )
    }

    return null
}

TypeScript (서버 사이드)

function parseDeepLink(url: string): DeepLinkData | null {
  const parsed = new URL(url);
  const segments = parsed.pathname.split('/').filter(Boolean);

  // Path parameter extraction with pattern matching
  const routes: RoutePattern[] = [
    { pattern: ['products', ':productId'], screen: 'ProductDetail' },
    { pattern: ['users', ':userId', 'posts', ':postId'], screen: 'Post' },
    { pattern: ['offers', ':offerId'], screen: 'Offer' },
    { pattern: ['referral', ':referrerId'], screen: 'Referral' },
  ];

  for (const route of routes) {
    const params = matchRoute(segments, route.pattern);
    if (params) {
      return {
        screen: route.screen,
        pathParams: params,
        queryParams: Object.fromEntries(parsed.searchParams),
      };
    }
  }

  return null;
}

function matchRoute(
  segments: string[],
  pattern: string[]
): Record<string, string> | null {
  if (segments.length !== pattern.length) return null;

  const params: Record<string, string> = {};
  for (let i = 0; i < pattern.length; i++) {
    if (pattern[i].startsWith(':')) {
      params[pattern[i].substring(1)] = segments[i];
    } else if (pattern[i] !== segments[i]) {
      return null;
    }
  }
  return params;
}

자주 쓰는 파라미터 패턴

캠페인 추적 (UTM)

가능하면 UTM 파라미터 캠페인 어트리뷰션을 위해 이렇게 설정하세요:

https://app.example.com/offers/summer?utm_source=email&utm_medium=newsletter&utm_campaign=july-promo&utm_content=hero-banner
파라미터 목적 예시
utm_source 유입 경로 email, facebook, push
utm_medium 마케팅 매체 newsletter, 유료 광고, social
utm_campaign 캠페인 이름 july-promo, 개학 시즌
utm_content 콘텐츠 변형 hero-banner, 푸터 링크
utm_term 유료 검색 키워드 딥 링킹 튜토리얼

추천 파라미터

https://app.example.com/referral?ref=user123&reward=both
파라미터 목적
ref 추천인의 사용자 ID 또는 코드
reward 보상 유형 (referrer, 피추천인, 둘 다)
channel 추천을 공유한 방법 (sms, whatsapp, 복사)

프로모션 파라미터

https://app.example.com/products/summer-sale?promo=SAVE20&expires=2026-08-01
파라미터 목적
promo 자동으로 적용할 할인/프로모션 코드
expires 혜택이 만료되는 시점
min_order 최소 주문 금액

개인화 파라미터

https://app.example.com/home?locale=de&theme=dark&onboarding=skip
파라미터 목적
locale 현지화된 콘텐츠에 적용할 언어/지역
theme UI 테마 설정
onboarding 온보딩 흐름을 표시할지 여부

인코딩과 보안

URL 인코딩

파라미터는 반드시 올바르게 URL 인코딩되어야 해요:

// 파라미터 인코딩
const productName = "Summer Sale & 20% Off!";
const encoded = encodeURIComponent(productName);
// 결과: "SummerSale20Off!"

const url = `https://app.example.com/search?q=${encoded}`;

반드시 인코딩해야 하는 문자:

문자 인코딩 결과
공백 %20 또는 +
& %26
=
?
# %23
/
% %25

입력값 검증

딥 링크에서 받은 파라미터는 믿으면 안 돼요. 모든 값을 검증하세요:

function validateParams(params: Record<string, string>): Record<string, string> {
  const validated: Record<string, string> = {};

  // 허용할 파라미터 이름 목록
  const allowed = ['ref', 'campaign', 'promo', 'locale', 'q'];

  for (const [key, value] of Object.entries(params)) {
    if (!allowed.includes(key)) continue;

    // 값 길이 제한
    if (value.length > 256) continue;

    // HTML/스크립트 태그 제거
    const sanitized = value.replace(/<[^>]*>/g, '');

    validated[key] = sanitized;
  }

  return validated;
}

민감한 데이터

민감한 정보는 URL 파라미터에 넣지 마세요:

// 나쁜 예: URL에 토큰을 넣으면 로그, 분석 도구, referrer 헤더에 그대로 남아요
https://app.example.com/login?token=eyJhbGciOiJI...

// 더 나은 방법: 서버에서 확인하는 짧은 수명의 참조 값
https://app.example.com/auth/callback?code=abc123
// 앱이 보안 API 호출로 code를 토큰으로 교환해요

AASA와 쿼리 파라미터

최신 AASA 형식은 쿼리 파라미터 매칭을 지원해요:

{
  "applinks": {
    "details": [
      {
        "appIDs": ["TEAMID.com.example.app"],
        "components": [
          {
            "/": "/products/*",
            "comment": "모든 상품 페이지"
          },
          {
            "/": "/offers/*",
            "?": { "source": "app" },
            "comment": "source=app 파라미터가 있는 오퍼만 앱에서 열려요"
          }
        ]
      }
    ]
  }
}

이 설정에서는 https://app.example.com/offers/summer?source=app 경로는 앱을 열지만 https://app.example.com/offers/summer?source=web 경로는 그렇지 않아요.

파라미터가 있는 동적 라우트

서버 사이드 파라미터 처리

동적 라우트는 서버가 경로 파라미터로 콘텐츠를 찾아요:

app.get('/products/:productId', async (req, res) => {
  const { productId } = req.params;
  const product = await db.getProduct(productId);

  if (!product) {
    // 없는 상품: 404를 보여 주거나 상품 목록으로 리다이렉트
    return res.redirect('/products');
  }

  // 모바일: 앱으로 리다이렉트
  if (isMobile(req)) {
    return res.redirect(`myapp://products/${productId}`);
  }

  // 데스크톱: 웹 페이지 표시
  res.render('product', { product });
});

클라이언트 사이드 파라미터 처리

// iOS: 딥 링크에서 상품 ID 처리
func showProduct(from url: URL) {
    let data = parseDeepLink(url)
    guard let productId = data?.pathParams["productId"] else {
        showHomeScreen()
        return
    }

    // 쿼리 파라미터 적용
    if let promoCode = data?.queryParams["promo"] {
        applyPromoCode(promoCode)
    }

    // 화면 이동
    navigationController.pushViewController(
        ProductViewController(productId: productId),
        animated: true
    )
}

Tolinku 라우트는 경로 파라미터와 쿼리 파라미터를 모두 지원해요. 라우트를 설정할 때 동적 라우트 같은 파라미터 패턴을 넣으면 /products/:id 딥 링크를 통해 데이터가 자동으로 전달돼요.

라우팅은 다음을 참고하세요 딥 링크 라우팅: 사용자를 올바른 화면으로 보내는 방법. 전체 가이드는 다음 글을 참고하세요: 2026년 딥 링킹 완벽 가이드.

딥 링킹 팁을 메일로 받아 보세요

일주일에 한 번만 보내요. 스팸은 없어요.

앱에 딥 링킹을 추가해 볼까요?

유니버설 링크, 앱 링크, 디퍼드 딥 링킹, 분석을 몇 분 만에 설정할 수 있어요. 무료로 시작하세요.