Analytics.impression
Feature description
When the element is exposed, an analytics log is recorded. Use this when you want to record an impression log when an element below the scroll actually becomes visible on the screen. event to logs of the type event_type: 'impression' The parameter is recorded together.
log_nameIf it is not specified, based on the current path <pathname>::impression a name in the format is automatically used. In addition to the value you passed, the log parameters also automatically include the current page's query string (search), entrance path (referrer), deployment information (deployment_id, deployment_timestamp) is automatically included.
The current page URL is httpsIf it is not, the log is not sent.
Type
Analytics.impression(params?: { log_name?: string } & { [key: string]: LogParam }): Promise<void> | undefined;Params
// Keys other than log_name are also recorded as log parameters.
type LogParam = string | number | boolean | null | undefined;Response
The current page URL is httpsIf it is not, the log is not sent and undefinedis returned.
Example code
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: "promotion banner" });
observer.unobserve(entry.target);
}
});
});
observer.observe(banner);Was this helpful?