I try to send product payment data to google analytics from the server, in response I get a status of 200, but in google analytics itself neither in normal events nor in debug view, I don't see my event, what am I doing wrong?
code:
const axios = require('axios')
const main = async () => {
const payload = {
client_id: 'xxxxxxxxxx.yyyyyyyyyy', // here my real client_id from cookies
events: [
{
name: 'test_payment_purchase',
params: {
debug_mode: 1,
currency: 'USD',
value: 30,
engagement_time_msec: '100',
session_id: '123', //?
items: [
{
item_name: 'test_one',
item_id: '10',
item_category: 'RUBY',
item_variant: 'ruby',
quantity: 1,
price: 30,
item_brand: 'Brand'
}
]
}
}
]
}
try {
const url = `https://www.google-analytics.com/debug/mp/collect?measurement_id=${process.env.GA4_MEASUREMENT_ID}&api_secret=${process.env.GA4_API_SECRET}`
const resp = await axios.post(url, payload)
console.log(resp.status)
console.log('Purchase event sent successfully in debug mode')
} catch (error) {
console.error('Error sending purchase event in debug mode:', error)
}
}
main()
Every run, return status 200, but no data in GA tables
shell 204 Purchase event sent successfully in debug mode
I get status 204(((