electerious / ackee-tracker

Transfer data to Ackee.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error: Server returned with an unhandled status

drgarlic opened this issue · comments

commented

Hi,

I just finished the setup of the server, everything works fine when I try Ackee with the <script> but with ackee-tracker I get an error. I tried removing parameters but no matter what I do, it still crashes when I call .record()

Here's a photo:

Screen Shot 2020-06-14 at 4 06 54 PM

And the code

    const instance = ackeeTracker.create({
        server: 'https://ackee.gawlik.io',
        domainId: 'acf48a42-b795-4202-834d-e23531572138',
    });

    instance.record({
        siteLocation: window.location.href,
        siteReferrer: document.referrer,
    });

Maybe it's stupid, but I really couldn't find the solution,

Anyway, thanks for this great tracker 👍

That's interesting. Can you show me the response of the server? It seems that it returns some kind of XML, which shouldn't be the case.

commented

Of course I forgot to check that ! My bad, here's the response:

Screen Shot 2020-06-16 at 4 28 26 PM

And here's what's being send:

Screen Shot 2020-06-16 at 4 28 13 PM

Looks like document.referrer returns an empty string instead of undefined. I recommend to do the following:

// This will use the default attributes which are polished to not include empty strings
instance.record();
// This should work because we're replacing the empty string with undefined
instance.record({
    siteLocation: window.location.href,
    siteReferrer: document.referrer || undefined,
});

I've already adjusted the next version to do the normalisation on the server instead. It therefore shouldn't happen in the next big release :)

commented

Thanks for the help !