💎
Headless Docs
Version 0.2.0
Version 0.2.0
  • Overview
  • Change Log
  • Next.js Steps
    • Requirements
    • Determine Page Methods
      • Route Hashing Method
      • Cookies Method
    • Install Middleware
    • Add Intelligems Provider
    • Read User Context
      • Route Hashing Method
      • Cookies Method
    • Track Page Views
    • Update Prices on Page
    • Update ATC Events
    • Preview Your Site
  • Gatsby Steps
    • Requirements
    • Add Intelligems Provider
    • Track Page Views
    • Update Prices on Page
    • Update ATC Events
    • Preview Your Site
  • Pack Digital Steps
    • Requirements
    • Add Intelligems Provider
    • Track Page Views
    • Update Prices on Page
    • Update ATC Events
    • Preview Your Site
  • Examples
    • Content Testing
  • Reference
    • Middleware Objects
      • IgMiddlewareConfig
      • IgMiddlewareHandler
    • Providers
      • Next.js
      • Gatsby
    • Components
      • Price Components
    • Hooks
      • Price Hooks
      • Track Hooks
      • Experiment Hooks
      • Test Group Hooks
      • Cart & Checkout Hooks
Powered by GitBook
On this page
  1. Reference
  2. Middleware Objects

IgMiddlewareHandler

PreviousIgMiddlewareConfigNextProviders
export interface IgMiddlewareConfig {
  settings: IgMiddlewareConfigSettings;
  routes: {
    forceSkipRoutes?: string[];
    getServerSidePropsRoutes?: string[];
    getStaticPropsRoutes?: string[];
  };
}

export interface IgMiddlewareConfigSettings {
  enabled: boolean;
  orgId: string;
  cacheIntervalMinutes?: number;
}

class IgMiddlewareHandler(req: NextRequest, igConfig: IgMiddlewareConfig){
    setContext(res: NextResponse): Promise<NextResponse | undefined>;
}

Routes specified in routes follow the same pattern as the Next.js .

  1. MUST start with /

  2. Can include named parameters: /about/:path matches /about/a and /about/b but not /about/a/c

  3. Can have modifiers on named parameters (starting with :): /about/:path* matches /about/a/b/c because * is zero or more. ? is zero or one and + one or more

  4. Can use regular expression enclosed in parenthesis: /about/(.*) is the same as /about/:path*

Read more details on documentation.

matcher
path-to-regexp