Skip to main content
Solved

Creating Shopify Events with the API

  • February 9, 2024
  • 1 reply
  • 520 views

Forum|alt.badge.img+1

I’ve worked out how to create events for a specific Profile using the API. However, I wish to re-create a Shopify Event using the “Checkout started” Metric. My call works fine but it creates a duplicate “Checkout started” Metric instead of referencing the existing Shopify one.

 

Is it possible to create a Shopify event using the API?

 

My code is below. I’m using php cURL requests if you’re wondering about the formatting. It’s json encoded before setting the payload for the API call.

 

$postFields = [
    "data" => [
        "type" => "event",
        "attributes" => [
            "properties" => [
                    "action" => "Checkout started",
                    "service" => "Shopify"
            ],
            "metric" => [
                "data" => [
                    "type" => "metric",
                    "attributes" => [
                        "name" => "Checkout started"
                    ]
                ]
            ],
            "profile" => [
                "data" => [
                    "type" => "profile",
                    "id" => "01G2T29KZKM491FQGGXC1HPFP7"
                ]
            ],
            "time" => "2023-11-10T00:00:00"
        ]
    ]
];

Best answer by retention

Hi @hughcottam12, welcome to the developer community here!

So as far as I know, the native built-in Shopify events from the Klaviyo + Shopify Integration can’t be overloaded - so if you create your own “Placed Order” event, it’s a completely separate “API Metric.”  Klaviyo separate the native integration events from the API Custom Events as evident in just the way they list out the Metrics in their interface:

If you take the time to build the same data structure and properties of a “Placed Order” that you pass into Klaviyo via the API, I don’t see why you couldn’t use your own user defined API “Placed Order” over the native version.  Just note, the native version is fairly robust and has a ton of nested fields and values.  One drawback is that since it’s native to Klaviyo, it’s probably going to better maintained and updated over time.  

 

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

1 reply

retention
Partner - Platinum
Forum|alt.badge.img+62
  • 2025 Champion
  • 988 replies
  • Answer
  • February 11, 2024

Hi @hughcottam12, welcome to the developer community here!

So as far as I know, the native built-in Shopify events from the Klaviyo + Shopify Integration can’t be overloaded - so if you create your own “Placed Order” event, it’s a completely separate “API Metric.”  Klaviyo separate the native integration events from the API Custom Events as evident in just the way they list out the Metrics in their interface:

If you take the time to build the same data structure and properties of a “Placed Order” that you pass into Klaviyo via the API, I don’t see why you couldn’t use your own user defined API “Placed Order” over the native version.  Just note, the native version is fairly robust and has a ton of nested fields and values.  One drawback is that since it’s native to Klaviyo, it’s probably going to better maintained and updated over time.  

 


Reply