Using Google Analytics in a Figma Plugin

Hi everyone,

I’m trying to use Google analytics in my Figma Plugin to track usage. I get the following Security error when Google Analytics is initialized.
‘SecurityError: Failed to read the ‘cookie’ property from ‘Document’: Cookies are disabled inside ‘data:’ URLs.’

Has anyone had any luck with using a analytics solution inside your plugin ?

Thanks!

6 Likes

Up ! Interested by this topic :slight_smile:

@Matthieu_Lepine I was able to use mixpanel for this. Check out mixpanel-figma - npm

3 Likes

I’m also very interested in this.

But are we getting a cookie insent message first then? Or do you get notified about the fact you’re using GA? This because I’m not quite sure how this will work with GDPR

this worked well for me! recommend for others.

1 Like

It’s worked well for me too! :grinning: Thanks!

I wanted to track the plugin analytic and I was playing with mixpanel-figma - npm as well. I also made more advances tracking with New Relic. Take a look to this article if you want to know more How to get analytics and observe your Figma plugin behavior

Is mixpanel-figma still working for everyone?

I keep getting a TypeError: cannot read property 'console' of undefined when loading the plugin after adding:

mixpanel.init({myToken}, {
  disable_cookie: true,
  disable_persistence: true
})

I want this feature, who knows how to use Google Analytics 4 in a Figma plugin

1 Like

@Miranda_Bailey how did u set up GA4 in the first place, can u help me out

Still working for me, I also had the same error, then I moved this init function inside the UI entry file not inside the code entry file, it has the console window function running once triggered.

Hi @Miranda_Bailey do you have instructions on how to connect Google Analytics to Figma prototype?