For the complete documentation index, see llms.txt. This page is also available as Markdown.

Analytics.impression

기능 설명

요소가 노출되면 분석 로그를 남겨요. 스크롤 아래에 있는 요소가 실제로 화면에 보였을 때 노출 로그를 기록하고 싶을 때 사용해요. event 유형의 로그에 event_type: 'impression' 파라미터가 함께 기록돼요.

log_name을 지정하지 않으면 현재 경로를 기반으로 <pathname>::impression 형식의 이름이 자동으로 사용돼요. 로그 파라미터에는 전달한 값 외에도 현재 페이지의 쿼리 스트링(search), 진입 경로(referrer), 배포 정보(deployment_id, deployment_timestamp)가 자동으로 포함돼요.

현재 페이지 URL이 https가 아니면 로그를 보내지 않아요.

타입

Analytics.impression(params?: { log_name?: string } & { [key: string]: LogParam }): Promise<void> | undefined;

Params

// log_name 외의 키는 로그 파라미터로 함께 기록돼요.
type LogParam = string | number | boolean | null | undefined;

Response

현재 페이지 URL이 https가 아니면 로그를 보내지 않고 undefined를 반환해요.

예시 코드

JavaScript

import { Analytics } from "@apps-in-toss/web-framework";

const banner = document.querySelector("#promo-banner");

const observer = new IntersectionObserver((entries) => {
  entries.forEach((entry) => {
    if (entry.isIntersecting) {
      Analytics.impression({ log_name: "banner", text: "프로모션 배너" });
      observer.unobserve(entry.target);
    }
  });
});

observer.observe(banner);

도움이 되었나요?