Solved

_learnq function

  • 8 June 2023
  • 2 replies
  • 184 views

Userlevel 1
Badge +4

Hi, we are having issues with learnq not showing up in certain product pages when those pages are visited. In certain product pages, I see learnq in developer mode within chrome, but in others, it’s missing so we’re not getting viewed product nor add to cart metrics for those items that are missing learnq.

We are hosted with bigcommerce and they use product.html for snippets which covers all product pages.

Any suggestions on how to fix this issue?

Thanks so much!!! :)

Jay

icon

Best answer by Brian Turcotte 9 June 2023, 19:59

View original

2 replies

Userlevel 7
Badge +36

Hi @tracingrobots!

Here’s a Community thread that discusses this issue quite thoroughly, with several different code examples:

 

Also, if you haven’t already seen it, we do recommend upgrading from _learnq to the new klaviyo object, which offers more robust support for asynchronous JavaScript implementations with callbacks and promises. Here is the developer guide on the klaviyo object and how to transition from _learnq:

 

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

- Brian

Userlevel 1
Badge +4

Hi @tracingrobots!

Here’s a Community thread that discusses this issue quite thoroughly, with several different code examples:

 

Also, if you haven’t already seen it, we do recommend upgrading from _learnq to the new klaviyo object, which offers more robust support for asynchronous JavaScript implementations with callbacks and promises. Here is the developer guide on the klaviyo object and how to transition from _learnq:

 

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

- Brian

This is great. with the updated code on that link will it reflect, viewed page, viewed product and added to cart

function myCallback() { var item = { "ProductName": item.ProductName, "ProductID": item.ProductID, "SKU": item.SKU, "Categories": item.Categories, "ImageURL": item.ImageURL, "URL": item.URL, "Brand": item.Brand, "Price": item.Price, "CompareAtPrice": item.CompareAtPrice }; klaviyo.track("Viewed Product", item); } klaviyo.identify({ '$email' : 'thomas.jefferson@example.com', '$first_name' : 'Thomas', '$last_name' : 'Jefferson' }, myCallback);

 

Reply