You've already forked OpenIntegrations
mirror of
https://github.com/Bayselonarrend/OpenIntegrations.git
synced 2026-05-22 10:05:29 +02:00
84 lines
2.9 KiB
Plaintext
84 lines
2.9 KiB
Plaintext
---
|
|
sidebar_position: 1
|
|
---
|
|
|
|
import Tabs from '@theme/Tabs';
|
|
import TabItem from '@theme/TabItem';
|
|
|
|
# Create counter
|
|
Creates a counter by field description
|
|
|
|
|
|
|
|
`Function CreateCounter(Val Token, Val CounterStructure) Export`
|
|
|
|
| Parameter | CLI option | Type | Required | Description |
|
|
|-|-|-|-|-|
|
|
| Token | --token | String | ✔ | Auth token |
|
|
| CounterStructure | --fields | Structure of KeyAndValue | ✔ | Counter structure. See GetCounterStructure |
|
|
|
|
|
|
Returns: Map Of KeyAndValue - serialized JSON response from Yandex
|
|
|
|
<br/>
|
|
|
|
:::tip
|
|
Method at API documentation: [Creating a counter](https://yandex.ru/dev/metrika/en/management/openapi/counter/addCounter)
|
|
:::
|
|
<br/>
|
|
|
|
|
|
```bsl title="1C:Enterprise/OneScript code example"
|
|
Token = "y0_AgAAAABdylaOAAy9KgAAAAEXh6i...";
|
|
|
|
CounterStructure = New Structure;
|
|
CounterStructure.Insert("autogoals_enabled", True);
|
|
|
|
CodeSettingsStructure = New Structure;
|
|
CodeSettingsStructure.Insert("async" , 0);
|
|
CodeSettingsStructure.Insert("clickmap" , 1);
|
|
CodeSettingsStructure.Insert("ecommerce" , 1);
|
|
CodeSettingsStructure.Insert("in_one_line" , 0);
|
|
CodeSettingsStructure.Insert("track_hash" , 1);
|
|
CodeSettingsStructure.Insert("visor" , 1);
|
|
CodeSettingsStructure.Insert("xml_site" , 0);
|
|
CodeSettingsStructure.Insert("ytm" , 0);
|
|
CodeSettingsStructure.Insert("alternative_cdn", 1);
|
|
|
|
InformerStructure = New Structure;
|
|
InformerStructure.Insert("color_arrow", 1);
|
|
InformerStructure.Insert("color_end" , "EFEFEFFE");
|
|
InformerStructure.Insert("color_start", "EEEEEEEE");
|
|
InformerStructure.Insert("color_text" , 0);
|
|
InformerStructure.Insert("enabled" , 1);
|
|
InformerStructure.Insert("indicator" , "uniques");
|
|
InformerStructure.Insert("size" , 2);
|
|
InformerStructure.Insert("type" , "ext");
|
|
|
|
CodeSettingsStructure.Insert("informer", InformerStructure);
|
|
|
|
CounterStructure.Insert("code_options", CodeSettingsStructure);
|
|
|
|
FlagsStructure = New Structure;
|
|
FlagsStructure.Insert("collect_first_party_data" , True);
|
|
FlagsStructure.Insert("measurement_enabled" , True);
|
|
FlagsStructure.Insert("use_in_benchmarks" , True);
|
|
FlagsStructure.Insert("direct_allow_use_goals_without_access", True);
|
|
|
|
CounterStructure.Insert("counter_flags" , FlagsStructure);
|
|
CounterStructure.Insert("favorite" , 1);
|
|
CounterStructure.Insert("filter_robots" , 2);
|
|
CounterStructure.Insert("gdpr_agreement_accepted", 1);
|
|
|
|
DomainStructure = New Structure("site", "openintegrations.dev");
|
|
|
|
CounterStructure.Insert("site2", DomainStructure);
|
|
|
|
Result = OPI_YandexMetrika.CreateCounter(Token, CounterStructure);
|
|
```
|
|
|
|
|
|
|
|
|
|
|