All files / src/contexts/Analytics types.ts

0% Statements 0/0
0% Branches 0/0
0% Functions 0/0
0% Lines 0/0

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33                                                                 
/**
 * Object sent to pageview event. The hook will only require a sub-set of this data
 */
export interface PageViewConfig {
  page: {
    pageURL: string; // Can allow hook to infer this
    pageType?: "errorPage"; // Only use for 404
  };
  event: {
    type: "pageview";
    name: string; // i.e Search Page Load
    description?: string; // Opt description, 100chars or less
  };
  // Custom Variables that may be passed for a pageview call. These may or may not be implemented at a later date
  data?: Record<string, any>;
}
 
export interface PageViewOptions {
  page?: Omit<PageViewConfig["page"], "pageURL">;
  event: {
    name: string; // If not defined, will use `${page.pageName} Load`
    description?: string;
  };
}
 
export interface ClickEventConfig {
  event: {
    type: "click";
    name: string;
    description?: string;
  };
}