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

Support for 'set' command #629

Open
sergigracia opened this issue Dec 5, 2023 · 1 comment
Open

Support for 'set' command #629

sergigracia opened this issue Dec 5, 2023 · 1 comment

Comments

@sergigracia
Copy link

sergigracia commented Dec 5, 2023

Hi there, I noticed there is no support for the set command (docs here). This is especially useful for tracking user properties. Is this planned? is there any workaround through this library? Thank you!

@eth0izzle
Copy link

I was also wondering the same. You can copy the code from https://github.com/MauricioRobayo/nextjs-google-analytics/blob/main/src/interactions/event.ts and modify it to call window.gtag("set"). Like so

export function set(
    option: string,
    { ...otherOptions }: ConfigOption = {}
): void {
    if (!(window as any).gtag) {
        return;
    }

    (window as any).gtag("set", option, otherOptions);
};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants