1
0
mirror of https://github.com/Bayselonarrend/OpenIntegrations.git synced 2026-05-22 10:05:29 +02:00
Files
OpenIntegrations/docs/en/md/Yandex_Metrika/Counters-management/Update-counter.mdx
T
Vitaly the Alpaca (bot) 93ecc5e526 Main build (Jenkins)
2024-11-10 16:31:06 +03:00

56 lines
1.6 KiB
Plaintext

---
sidebar_position: 2
---
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
# Update counter
Changes counter field values by ID
`Function UpdateCounter(Val Token, Val CounterID, Val CounterStructure) Export`
| Parameter | CLI option | Type | Required | Description |
|-|-|-|-|-|
| Token | --token | String | ✔ | Auth token |
| CounterID | --counter | String, Number | ✔ | Counter ID to change |
| CounterStructure | --fields | Structure of KeyAndValue | ✔ | Structure of fields to be changed. See GetCounterStructure |
Returns: Map Of KeyAndValue - serialized JSON response from Yandex
<br/>
:::tip
Method at API documentation: [Changing a counter](https://yandex.ru/dev/metrika/en/management/openapi/counter/editCounter)
:::
<br/>
```bsl title="1C:Enterprise/OneScript code example"
Token = "y0_AgAAAABdylaOAAy9KgAAAAEXh6i...";
CounterID = "98874849";
CounterStructure = New Structure;
CounterStructure.Insert("autogoals_enabled", True);
FlagsStructure = New Structure;
FlagsStructure.Insert("collect_first_party_data" , False);
FlagsStructure.Insert("measurement_enabled" , False);
FlagsStructure.Insert("use_in_benchmarks" , False);
FlagsStructure.Insert("direct_allow_use_goals_without_access", False);
CounterStructure.Insert("counter_flags" , FlagsStructure);
CounterStructure.Insert("favorite" , 0);
CounterStructure.Insert("filter_robots" , 1);
Result = OPI_YandexMetrika.UpdateCounter(Token, CounterID, CounterStructure);
```