{"action":"created","issue":{"url":"https://api.github.com/repos/nixsolutions/yandex-php-library/issues/101","labels_url":"https://api.github.com/repos/nixsolutions/yandex-php-library/issues/101/labels{/name}","comments_url":"https://api.github.com/repos/nixsolutions/yandex-php-library/issues/101/comments","events_url":"https://api.github.com/repos/nixsolutions/yandex-php-library/issues/101/events","html_url":"https://github.com/nixsolutions/yandex-php-library/issues/101","id":107227351,"number":101,"title":"Цель типа \"action\" не создается","user":{"login":"antonsnowy","id":1109643,"avatar_url":"https://avatars.githubusercontent.com/u/1109643?v=3","gravatar_id":"","url":"https://api.github.com/users/antonsnowy","html_url":"https://github.com/antonsnowy","followers_url":"https://api.github.com/users/antonsnowy/followers","following_url":"https://api.github.com/users/antonsnowy/following{/other_user}","gists_url":"https://api.github.com/users/antonsnowy/gists{/gist_id}","starred_url":"https://api.github.com/users/antonsnowy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/antonsnowy/subscriptions","organizations_url":"https://api.github.com/users/antonsnowy/orgs","repos_url":"https://api.github.com/users/antonsnowy/repos","events_url":"https://api.github.com/users/antonsnowy/events{/privacy}","received_events_url":"https://api.github.com/users/antonsnowy/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-09-18T15:47:26Z","updated_at":"2015-09-18T16:28:53Z","closed_at":"2015-09-18T16:28:53Z","body":"У кого-нибудь получалось создавать цель \"JavaScript событие\"? У меня: Service responded with error code: \"400\" and message: \"Bad Request\".\r\n\r\n// это работает, url\r\n$condition = new Yandex\\Metrica\\Management\\Models\\Condition();\r\n$condition\r\n    ->setType('contain')\r\n    ->setUrl('ADD_TO_CART');\r\n\r\n$conditions = new Yandex\\Metrica\\Management\\Models\\Conditions();\r\n$conditions->add($condition);\r\n\r\n$goal = new Yandex\\Metrica\\Management\\Models\\Goal();\r\n$goal\r\n    ->setName('some name')\r\n    ->setType('url')\r\n    ->setConditions($conditions);\r\n\r\n$result = $managementClient\r\n    ->goals()\r\n    ->addGoal($counterId, $goal)->toArray();\r\n\r\n\r\n// это не работает, javascript\r\n$condition = new Yandex\\Metrica\\Management\\Models\\Condition();\r\n$condition\r\n    ->setType('action')\r\n    ->setUrl('ADD_TO_CART');\r\n\r\n$conditions = new Yandex\\Metrica\\Management\\Models\\Conditions();\r\n$conditions->add($condition);\r\n\r\n$goal = new Yandex\\Metrica\\Management\\Models\\Goal();\r\n$goal\r\n    ->setName('some other name')\r\n    ->setType('action')\r\n    ->setConditions($conditions);\r\n\r\n$result = $managementClient\r\n    ->goals()\r\n    ->addGoal($counterId, $goal)->toArray();"},"comment":{"url":"https://api.github.com/repos/nixsolutions/yandex-php-library/issues/comments/141499271","html_url":"https://github.com/nixsolutions/yandex-php-library/issues/101#issuecomment-141499271","issue_url":"https://api.github.com/repos/nixsolutions/yandex-php-library/issues/101","id":141499271,"user":{"login":"antonsnowy","id":1109643,"avatar_url":"https://avatars.githubusercontent.com/u/1109643?v=3","gravatar_id":"","url":"https://api.github.com/users/antonsnowy","html_url":"https://github.com/antonsnowy","followers_url":"https://api.github.com/users/antonsnowy/followers","following_url":"https://api.github.com/users/antonsnowy/following{/other_user}","gists_url":"https://api.github.com/users/antonsnowy/gists{/gist_id}","starred_url":"https://api.github.com/users/antonsnowy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/antonsnowy/subscriptions","organizations_url":"https://api.github.com/users/antonsnowy/orgs","repos_url":"https://api.github.com/users/antonsnowy/repos","events_url":"https://api.github.com/users/antonsnowy/events{/privacy}","received_events_url":"https://api.github.com/users/antonsnowy/received_events","type":"User","site_admin":false},"created_at":"2015-09-18T16:28:53Z","updated_at":"2015-09-18T16:28:53Z","body":"Разобрался. У цели типа action могут быть условия только типа exact. Из документации кажется, что тип \"action\" https://tech.yandex.ru/metrika/doc/api2/management/goals/class_goale-docpage/#class_goale"}}