I'm trying to use the Klaviyo API to add custom metric when a particular page is viewed. I have followed the instructions from the klaviyo post here:
but the custom metric isn't being counted.
The reason we need this is to determine which users have completed checkout for an abandoned cart flow. The default Klaviyo flow won't work with our application because some payments are not done immediately. For example interac e-transfers, our customers will still receive an abandoned cart email after they have successfully checked out.
If we can create a metric on users who have or have not visited our Woocomerce "thank you" page we can accurately target them with an abandoned cart flow.
We could add a filter to the flow to make sure only those who didn't visit that thank you page in the last few hours would be targeted.
There's a section in the tutorial that recommends using a UTM parameter to test the email address. I don't quite understand if your saying every URL would need this UTM parameter to track views.
Best answer by RedPhiveView original
Glad you were able to get in touch with Support and get it working! This will be a valuable reference for other Community members.
Thanks for using the Community!
So I was able to get it to work with the help of support by adding a bit of script to the same page.
With my company ID where those Xs are.
Thanks for the response.
I tested with a email address that has been cookied and already tracking API calls through the website.
I can see the entire website activity “viewed product” & “add to cart” the nothing when the user visits the page with the code.
The script is implemented and located next to another similar script which is active and firing correctly.
@RedPhive and welcome back to the Community!
First off, may I ask how you’re testing the custom metric? One important thing to note is that the metric will only be tracked for customers that have been previously cookied. So if you’re testing from a browser where you haven’t entered your email or been captured by your store in another way, the testing would fail. Likewise, if customers visit the site and haven’t been cookied, they won’t appear either.
That’s also what is being referred to in the Help Center - the point of appending the UTM parameter to the URL for testing is to simulate a previously cookied account, so that you can test from your own end. It’s not something that has to be considered for external visitors, since they will either be cookied previously or not - it’s just for testing.
I hope this helps to clarify, and thanks for using the Community!