My question is more a confirmation than a problem itself, I will give a general context of what my company does so that you understand everything that I have to deal with.

The company in which I work is an e-commerces sales review evaluator, we send an email to the buyer and he responds with his words and then this review appears in a component (widget) that is on the product preview page within the E-commerce, available for likely customers to see what they actually bought said.

My task then, was to have the user interactions appear on the client's analytics, so that we could evaluate who used our product and then made a purchase for example. I have evaluated how best to use events.

But the big problem I faced was to make it work in all possible analytics settings (with tag manager, analytics.js, ga.js) anyway, all possible settings.

And I got to that final code in (coffeescript)

@sendEvent: (action, product_name) ->
  category = 'OurCompany Widget'
  commonOptions = [category, action, product_name]

  if typeof ga == 'function' && typeof ga.getAll == 'function'
    trackers = ga.getAll()

    if trackers.length > 0
      ga ->
        _.each ga.getAll(), (tracker) ->
          ga "#{tracker.get('name')}.send", 'event', commonOptions...
      ga 'send', 'event', commonOptions...

  if typeof _gaq != 'undefined' || typeof _gat != 'undefined' && typeof _gat._getTrackers != 'undefined'
    _.each _gat._getTrackers(), (tracker) ->
      tracker._trackEvent commonOptions...

So the questions I ask you:

  • Is there a better way to get an integration with all possible combinations of analytics?
  • Can this current format cause any kind of damage to client data? (We received a complaint - just this one - from one of the customers saying that after triggering our tracking it interfered with capturing purchase data from them "they lost those data")
  • And there are a few stores where buying influence data appears zeroed, simply the segments I created (basically filters by event action name) only returns 0.0% while the "All Users" segments appear OK (and yes the events are Being triggered - appear in the Real Time tab), my hypothesis is the payment gateway is cutting off all session events when the customer will pay (this website sells cosmetics and a segment filtering by woman only returns 2 sales from more than 500 sales, did you agree with this?).

1 Answer 1


You have taken an interesting approach for solving this across all GA implementations!

What worries me is the broad strokes with which you are spamming all GA trackers with your event data. Let's take a site which uses a third party chat widget (e.g Olark). As I understand, they have their own GA in there somewhere, and this javascript will take all trackers and send the event data in those.

That would send additional events in 3rd party systems which may or may not be processed by those systems. Seems a strong handed approach.

An alternative approach

Wouldn't creating a separate tracker object and sending your event data through it be easier?

I know it would create some additional overhead, but at least the data you are sending to would be reliably stored in just the right account.

As far as the third point you are asking, is it possible for you to share the segment?

  • Thanks a lot @Prasad for your time and answer! Unfortunately, I can't use your alternative approach because I need to match the data from the host with my own generated data. If I could intercept the host data, it's ok, but I don't know if is possible! Commented Feb 3, 2017 at 2:44
  • About the segment, check it: analytics.google.com/analytics/web/… Is a simple segment, but power full when used inside of Conversions > Ecommerce > Overview. It Shows to us, how many people that purchased something have interacted with our widget. Commented Feb 3, 2017 at 3:37
  • Bruno, is the Ecommerce reports showing data otherwise? If your events are being stored and you are segmenting on just the category, I dont see any problem with why data would not show up. The only case where this would happen is if your script is blocked for the paying customers. Commented Feb 3, 2017 at 5:52
  • It is not a problem exclusively ours, because we tested segments with simple attributions of gender (male / female), and we could not get any information either. Our suspects are about e-commerce payment gateway. It takes the user to another domain (but inside of the same tab) and after confirm payment it returns inside the same tab to the site domain... Commented Feb 3, 2017 at 17:32
  • uh, so when the user comes back to the site domain, is the return url tagged in a manner wherein a new GA session is created? What does the Multi-channel funnel reports say? Commented Feb 4, 2017 at 5:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.