Skip to content

analytics.js firing events before clevetap can be initialized #740

Description

@sinhaayush7

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.

Could you help us with a workaround for this?
Screenshot 2023-03-27 at 11 54 59 AM

Activity

  1. joe-ayoub-segment commented on Mar 29, 2023

    @joe-ayoub-segment
    Contributor

    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:

    1. link to website where Segment and Clevertap are configured
    2. reproduction steps explaining how to demonstrate the issue happening

    Thanks you,
    Joe

  2. KambleSonam commented on Mar 30, 2023

    @KambleSonam

    @joe-ayoub-segment We have sent mail with the required links and steps to replicate the issue. Kindly look into it on priority.

  3. joe-ayoub-segment commented on Mar 30, 2023

    @joe-ayoub-segment
    Contributor

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions