Solved

What do response 2 mean?

  • 21 November 2022
  • 3 replies
  • 33 views

Badge +3

I get a response 1 on my Identify events, but when I want to push one of the other types of events I get response 2. I can't find any documentation for what this 2 is supposed to mean.

icon

Best answer by Brian Turcotte 22 November 2022, 20:56

View original

3 replies

Userlevel 7
Badge +36

Hi @Mikkel-Poetype and welcome to the Community!

 

Would you be willing to share a screenshot (with any sensitive info redacted) of the response you are receiving? Also, what events in particular are resulting in the “2” response? This will just be helpful for myself and other members of the Community to get some more context on the issue.

 

The 1 response means the payload is valid, as documented here in our Developer portal if you haven’t already seen it. I haven’t come across the “2” response before, so it would certainly help to see what it looks like on your end.

 

Since the new APIs were released recently, some of our documentation is still being updated, as noted at the top of the page I linked above. Im the meantime, I will reach out to our engineering team to inquire and I’ll update the thread as soon as I hear back.

 

Thanks for using the Community!

 

- Brian

Badge +3

Hi Brian. of course I will do that.

Here is the script:

var _learnq = _learnq || [];
console.log("Identify Response:", _learnq.push(['identify', { '$email': 'nj@companyname.dk'}]))
let item = {
"ProductName": "Winnie the Pooh",
"ProductID": "1111",
"SKU": "WINNIEPOOH",
"Categories": ["Fiction", "Children"],
"ImageURL": "http://www.example.com/path/to/product/image.png",
"URL": "http://www.example.com/path/to/product",
"Brand": "Kids Books",
"Price": 9.99,
"DiscountValue": 7.99
};
console.log("Viewed Product Tracking Response:", _learnq.push(["track", "Viewed Product", item]))

The screenshot of the response

 

Userlevel 7
Badge +36

HI @Mikkel-Poetype,

 

The reason you are getting a 2 there is because it's just using the standard javascript push function reply that returns the number of items you've added to an array.  So for example const testarr = []; console.log(testarr.push('A')) //Returns 1; console.log(testarr.push('B')) //Returns 2.

 

It might also be helpful to point out that we are gradually transitioning away from the custom learnq object to the new klaviyo object, which will be better documented.

 

I hope this helps, and thanks for using the Community!

 

- Brian

Reply