Google Analytics API in inserting goals using PHP

124 Views Asked by At

I need help regarding the returned error after initiating request:

Here's the request body:

{
  "name": "Test Leads",
  "id": "2",
  "type": "Event",
  "active": true,
  "eventDetails": {
    "eventConditions": [
      {
        "type": "Category",
        "comparisonType": "EQUAL",
        "expression": "Leads"
      },
      {
        "type": "ACTION",
        "comparisonType": "EQUAL",
        "expression": "Create"
      }
    ],
    "useEventValue": true
  }
}

Error:

{"error":{
    "errors":[
      {"domain":"global","reason":"backendError","message":"Backend Error"}
    ],
    "code":500,
    "message":"Backend Error"
  }
}

Expected Goal Details when successfully posted: https://www.screencast.com/t/5QOJ28Tnk

Can someone check the code and see what's wrong or missing?

Thanks.

1

There are 1 best solutions below

0
charlie On
  "name": "Test Leads",
  "kind": "analytics#goal",
  "id": "2",
  "type": "Event",
  "active": true,
  "eventDetails": {
    "eventConditions": [
      {
        "type": "CATEGORY",
        "matchType": "EXACT",
        "expression": "Leads"
      },
      {
        "type": "ACTION",
        "matchType": "EXACT",
        "expression": "Create"
      }
    ],
    "useEventValue": true
  }
}```