analytics.js firing events before clevetap can be initialized
sinhaayush7 opened this issue · 3 comments
Upon looking, we found that analytics.js is firing events (via analytics.track) before clevertap can be initialized.
t requests are for segment
a?type=page is the first request that is triggered on clevertap initialization
From the screenshot, we can see that the request goes properly to the segment, but since clevertap is not initialized at that point, the events are being lost in the process.
Hi @sinhaayush7 ,
It's possible that this might be happening due to the way the customer has instrumented their website.
Would it be possible to ask the customer to raise a Support ticket by emailing friends@segment.com, and include reproduction steps so that our Support Engineers can look deeper into the issue?
If it wasn't a customer who raised this issue you could still raise a Support ticket with the same information.
If you could include the following in the email it would be useful:
- link to website where Segment and Clevertap are configured
- reproduction steps explaining how to demonstrate the issue happening
Thanks you,
Joe
@joe-ayoub-segment We have sent mail with the required links and steps to replicate the issue. Kindly look into it on priority.
Copying my note from Slack here for posterity.
hi Darshan and Sonam , thanks for raising the ticket. It will be a Customer Support Engineer who will respond to the ticket. I don't have permission to look at customer's Segment Workspaces.
If they determine that the issue is not related to the way the customer instrumented their website then they might reach out to me.
I did have a quick look at the customer's website and could see that Segment events were triggering Clevertap events. I didn't notice that there was a mismatch in the numbers.
However it did seem like the Segment events and Clevertap events were being fired a second or 2 after the page loaded.
Perhaps the customer is not loading the Segment JS snippet correctly? For optimal results it's best to hard code the Segment JS snippet into the head tag of the website.
Another thing the customer could look into is to not trigger any Segment events until the Segment analytics.ready() function has fired.
Documentation for this can be found here.
The ready() function only fires after the Destination JS libraries have completed loading. in this case it would mean that Clevertap's library would be loaded.
