Hacker News new | ask | show | jobs
by codezero 2142 days ago
Can't tell from the docs, but how do you deal with "stubbed" events that are triggered before segment/GA loads? Are you able to do anything to make sure your snippet loads fully before other third party scripts that might "do work"?

I guess put more simply, do you need to do work when implementing to make sure you don't miss any of the existing events being captured, or does this rely on the same developer implementing all three?

1 comments

We actually ask to insert a snippet after GA / Segment initialization code.

The algo is a follows: a) check if ga / analytics object is present b) add interceptor c) if the code was fully loaded (not a stup), send "fake" pageview event (which has been already sent), intercept it and send to EN backend only (not the original backend).

Also, we received a pull request that won't require EN code be inserted after GA/Segment. It tries to get window.ga/analytics object. If it doesn't exist, try the same thing in 1 second via setTimeout. We most likely with merge it to master soon

What I gets me wondering is that by having your own hosted solution you bypass adblockers but this implementation requires GA to be loaded, which is what adblockers block in the first place. Am I missing anything?
While we do have a hook to intercept GA data, it is actually optional! You can use the self hosted JS tracker that we include with EventNative and serve it from your domain.