Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface SendFunction

Hierarchy

  • SendFunction

Callable

  • SendFunction(payload: string, operation: DataDefinition): void | Promise<void>
  • Function to call when a batch is ready to send to Google Analytics. Will be invoked with the batch payload (a string where each line is a form URL-encoded GA hit) as well as the DataDefinition you should pass to the @paychex/core createRequest method.

    example
    import { createRequest, fetch } from '~/path/to/datalayer.js';

    async function send(payload, operation) {
    // optionally, extend fetch to provide custom logic
    // such as retries, connectivity checks, etc...
    await fetch(createRequest(operation, null, payload));
    }

    const collector = googleAnalytics(send, ga);
    export const tracker = trackers.create(collector);

    Parameters

    Returns void | Promise<void>