Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: add overloading to googleAnalytics.set #178

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/utils/googleAnalytics/set.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ import {gtag} from './initialize';
/** Allows you to set values that persist across all the subsequent gtag() calls on the page.
* {@link https://developers.google.com/gtagjs/reference/api#set API Reference}
* @param params key-value pairs that are to persist across gtag() calls. */
export function set(params: UnknownRecord): void;
/** Allows you to set values that persist across all the subsequent gtag() calls on the page.
* {@link https://developers.google.com/gtagjs/reference/api#set API Reference}
* @param name the fieldName of given params
* @param params key-value pairs that are to persist across gtag() calls. */
export function set(name: string, params: UnknownRecord): void;
export function set(...args: [string, UnknownRecord] | [UnknownRecord]) {
const params = args.pop();
const name = args.pop();
Expand Down