Skip to main content
Solved

_learnq function


Forum|alt.badge.img+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

Best answer by Brian Turcotte

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

View original
Did this topic or the replies in the thread help you find an answer to your question?

2 replies

Brian Turcotte
Forum|alt.badge.img+37

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


Forum|alt.badge.img+4
  • Author
  • Problem Solver I
  • 10 replies
  • June 11, 2023
Brian Turcotte wrote:

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);