@yext/analytics
Version:
An analytics library for Yext
21 lines • 1.07 kB
TypeScript
import { AnalyticsConfig } from './AnalyticsConfig';
import { EventPayload } from './EventPayload';
/**
* Used by the AnalyticsEventReport report() method to send an analytics event request via
* Beacon. Used when forceFetch is false and keepalive is not
* supported by the browser i.e. Firefox, the request is sent via the Beacon API.
*
* @param url URL that the request will be sent to
* @param body the EventPayload object
*/
export declare function postWithBeacon(url: string, body: EventPayload, config: AnalyticsConfig): boolean;
export declare function postWithFetch(url: string, body: EventPayload, config: AnalyticsConfig): Promise<Response>;
/**
* Returns a boolean that determines whether the post method should use beacon. Firefox and Firefox
* for Android do not support fetch + keepAlive, so useBeacon will return true if the browser is
* Firefox or Firefox for Android.
*
* @param body the EventPayload object
*/
export declare function useBeacon(body: EventPayload, forceFetch: boolean | undefined): boolean;
//# sourceMappingURL=post.d.ts.map