Skip to main content
Problem Solver I
June 8, 2023
Solved

_learnq function

  • June 8, 2023
  • 2 replies
  • 990 views

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

    This topic has been closed for replies.
    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

    2 replies

    Brian Turcotte
    Klaviyo Alum
    June 9, 2023

    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

    Problem Solver I
    June 11, 2023

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