analytics.js icon indicating copy to clipboard operation
analytics.js copied to clipboard

ga() function undefined in ready callback

Open kochis opened this issue 5 years ago • 1 comments

I'm trying to add a ga('require', '...') call as part of our Google Analytics integration, but having trouble access the function when GA is being loaded with segment (works fine when loaded via script tag). This is what I have

window.analytics.ready(function() {
  ga('require', 'Clearbit', { ... });
});

But ga is always undefined in this context. I'm following the docs here: https://segment.com/docs/connections/destinations/catalog/google-analytics/#multiple-trackers

Is there another way to access the underlying ga function? Or something that needs to be changed about the way GA is loaded / configured? Also apologies if this isn't the best place for these types of questions.

kochis avatar Dec 14 '20 22:12 kochis

I've started seeing this in my application as well since enabling Analytics 2.0

akonwi avatar Sep 08 '21 01:09 akonwi