Skip to main content
Solved

Assistance Required for GTM Server-Side Tracking with Klaviyo Integration

  • 10 July 2024
  • 1 reply
  • 68 views

I hope this message finds you well. I am reaching out for assistance with integrating Klaviyo with my Google Tag Manager (GTM) server-side container using the Klaviyo by stape.io custom template. I am experiencing an issue where the server response indicates "Body omitted because it contains binary data," and the data does not seem to be correctly processed.

 

Here are the details of my setup and the steps I've taken so far:

 

1. **Event Name:** I have ensured that the event name is correctly set without spaces or special characters.

2. **Payload Structure:** The payload is formatted in JSON and includes all necessary fields such as `email`, `phone_number`, `first_name`, `last_name`, `transaction_id`, `currency`, and other relevant properties.

3. **GTM Debugging:** I have tested the setup in GTM's preview mode and verified that the tag fires correctly, but the server response still shows the error.

 

The response body I receive is as follows (this is fake values):

```json

{

  "data": {

    "type": "event",

    "attributes": {

      "properties": {

        "page": "https:/example.net/order-received/2634/?key=wc_order_XgmL8GR9J2tYJ",

        "product_name": "productname",

        "currency": "USD",

        "product_category": "Summer",

        "product_id": 1350,

        "product_quantity": 1,

        "shipping_fee": 0,

        "transaction_id": 2634,

        "total_value": 26.9

      },

      "metric": {

        "data": {

          "type": "metric",

          "attributes": {

            "name": "purchase"

          }

        }

      },

      "profile": {

        "data": {

          "type": "profile",

          "attributes": {

            "properties": {

              "$last_referrer": "https://productpage.net/checkout"

            },

            "email": "example@gmail.com",

            "phone_number": 1234456789,

            "first_name": "name",

            "last_name": "lastname",

            "location": {

              "address1": "address",

              "address2": "",

              "city": "City",

              "country": "NE",

              "region": "",

              "zip": 1700

            }

          }

        }

      }

    }

  }

}

```

 

Could you please assist me in identifying the cause of this issue and provide guidance on how to resolve it? Your support would be greatly appreciated.

 

Thank you in advance for your help.

 

Best regards,

1 reply

Userlevel 5
Badge +30

Hi @alex1217

Can you please provide the exact response you are receiving from Klaviyo's server? Is it a 400 error or a different HTTP status code? Can you also please clarify which Klaviyo API endpoint you are using? It seems like POST to /api/events but it would help troubleshooting to clarify which endpoint.

 

Since there are numerous moving parts such as GTM and stape.io here, in order to troubleshoot the response from Klaviyo's server, it would help to isolate exactly this operation. To do this, please get the exact json payload that is being submitted to Klaviyo and submit it manually using curl, node-fetch, or a similar library and report back if you are still receiving the error and the exact payload you submitted.

 

In the example json payload you provided, there is an error. The phone number is formatted as a number, but the API requires an E.164 formatted phone number that is a text field, not a number.


Please also check to make sure email is no longer than 100 characters and phone number is formatted correctly. I hope this helps!

~Chloe

Reply