Skip to main content
Solved

API + GTM Integration (identify)


Forum|alt.badge.img+2

Hi,

we are implementing Klaviyo to a custom ecommerce platform. For now we have implemented the “Placed Order” event, which is working fine and it sent from our backend. 

Now we would like to implement “Active on Site” and “Add to cart” via Google Tag Manager. We have the codes in GTM and events are firing, but I think the problem is that the user is not identified properly. We do it like this:

When the user submits an order via website, Placed Order event and Identify request are sent via API. 

The user then browses on the website, but Klaviyo does not recognize him.

How to debug? What are we doing wrong? :) 

Thanks!

Best answer by retention

@tomazs - I’m not sure if this would be helpful, but there’s an API to check if a user is “identified” or not.  You can do this in Javascript by running _learnq.isIdentified() and it will return a true or false value.

As a side note, I think testing on localhost might be an issue, since the localhost top-level domain might not match the information in your Klaviyo account without the proper Cross Origin Requests Sharing (CORS) mechanism. 

Another possibility is Klaviyo’s Javascript can’t resolve localhost to a valid domain. A domain, by definition, needs at least 1 or more “dots” in it - unless you are doing some domain binding in your host file.  
I’d start by seeing if you can test your implementation on a subdomain of your site or try setting up a host file (/etc/host) to see if that would work.  

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

3 replies

stephen.trumble
Community Manager
Forum|alt.badge.img+60

Hey @tomazs !

Thank you so much for reaching out to the Klaviyo Community for help with this! Happy to help!

Just to confirm, you have used the Add to Cart and Active on site code snippets from guide on How to Add Klaviyo Web Tracking Using Google Tag Manager?

If you have and they are not functioning properly, you can forgo using GTM all together and use the Guide to Integrating a Standard eCommerce Platform which may help.

I would also reach out to the developer who created the custom ecommerce platform to help troubleshoot this further. Hope this helps get you back on track!

Thank you for being a part of the Klaviyo Community! 

 


Forum|alt.badge.img+2
  • Author
  • Contributor I
  • 2 replies
  • August 27, 2021

Hi,

yes, about the GTM integration - we have implemented it in the way as in the article. The problem is, the testing does not work - with utm_email parameter, nothing appears in Klaviyo Activity Feed.

Is the problem maybe that we are testing this on localhost? But “Placed Order” events works fine via API from localhost.

Thanks


retention
Partner - Platinum
Forum|alt.badge.img+62
  • 2025 Champion
  • 938 replies
  • Answer
  • August 31, 2021

@tomazs - I’m not sure if this would be helpful, but there’s an API to check if a user is “identified” or not.  You can do this in Javascript by running _learnq.isIdentified() and it will return a true or false value.

As a side note, I think testing on localhost might be an issue, since the localhost top-level domain might not match the information in your Klaviyo account without the proper Cross Origin Requests Sharing (CORS) mechanism. 

Another possibility is Klaviyo’s Javascript can’t resolve localhost to a valid domain. A domain, by definition, needs at least 1 or more “dots” in it - unless you are doing some domain binding in your host file.  
I’d start by seeing if you can test your implementation on a subdomain of your site or try setting up a host file (/etc/host) to see if that would work.