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

Enabling the plugin while application is working has no effect #16

Open
bart-iimpcoll opened this issue Oct 18, 2023 · 1 comment
Open

Comments

@bart-iimpcoll
Copy link

bart-iimpcoll commented Oct 18, 2023

Hello!

I implemented your plugin and I start the application with the plugin turned off by default. User needs to consent to cookies to enable the plugin. When I set the:
config.public.gtm.enabled = true;
nothing happens. The setup works if that value is true from the beginning. Any suggestion about what am I doing wrong?

My runtimeConfig:

runtimeConfig: {
    public: {
      ga_cookie: process.env.GA_COOKIE_NAME,
      gtm: {
        id: process.env.GTM_TAG,
        defer: false,
        compatibility: false,
        nonce: '2726c7f26c',
        enabled: false,
        debug: true,
        loadScript: true,
        enableRouterSync: true,
        trackOnNextTick: false,
        devtools: true,
      }
    }
  }, 
@bart-iimpcoll
Copy link
Author

bart-iimpcoll commented Oct 18, 2023

I made it work using this following code in my application, in one of Components (I'm using composition API):

    config.public.gtm.enabled = true;
    useGtm()?.enable(true)

it only works if both of them are included. It feels not correct though, is there a better way to achieve what I want to do?

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

1 participant