You've already forked OpenIntegrations
mirror of
https://github.com/Bayselonarrend/OpenIntegrations.git
synced 2026-05-22 10:05:29 +02:00
166 lines
5.8 KiB
Plaintext
166 lines
5.8 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);
|
|
```
|
|
|
|
|
|
|
|
|
|
```json title="Result"
|
|
{
|
|
"counter": {
|
|
"id": 98905589,
|
|
"status": "Active",
|
|
"owner_login": "bayselonarrend",
|
|
"code_status": "CS_ERR_UNKNOWN",
|
|
"activity_status": "low",
|
|
"type": "simple",
|
|
"favorite": 0,
|
|
"hide_address": 0,
|
|
"pro": 0,
|
|
"permission": "own",
|
|
"webvisor": {
|
|
"arch_enabled": 0,
|
|
"arch_type": "none",
|
|
"load_player_type": "proxy",
|
|
"wv_version": 2,
|
|
"allow_wv2": true,
|
|
"wv_forms": 1
|
|
},
|
|
"code_options": {
|
|
"async": 0,
|
|
"informer": {
|
|
"enabled": 1,
|
|
"type": "ext",
|
|
"size": 2,
|
|
"indicator": "uniques",
|
|
"color_start": "EEEEEEEE",
|
|
"color_end": "EFEFEFFE",
|
|
"color_text": 0,
|
|
"color_arrow": 1
|
|
},
|
|
"visor": 1,
|
|
"track_hash": 1,
|
|
"xml_site": 0,
|
|
"clickmap": 1,
|
|
"in_one_line": 0,
|
|
"ecommerce": 1,
|
|
"alternative_cdn": 1,
|
|
"ecommerce_object": "dataLayer",
|
|
"ytm": false
|
|
},
|
|
"create_time": "2024-11-13T10:44:59+03:00",
|
|
"time_zone_name": "Europe/Moscow",
|
|
"time_zone_offset": 180,
|
|
"partner_id": 0,
|
|
"update_time": "2024-11-13 10:45:00",
|
|
"code": "<!-- Yandex.Metrika informer -->\n<a href=\"https://metrica.yandex.com/stat/?id=98905589&from=informer\" target=\"_blank\" rel=\"nofollow\">\n <img src=\"//bs.yandex.ru/informer/98905589/2_1_EEEEEEEE_EFEFEFFE_0_uniques\"\n style=\"width:80px; height:31px; border:0;\"\n alt=\"Yandex.Metrica\"\n title=\"Yandex.Metrica: data for today (unique users)\"\n onclick=\"try{Ya.Metrika.informer({i:this,id:98905589,lang:'en'});return false}catch(e){}\"/>\n</a>\n<!-- /Yandex.Metrika informer -->\n\n<!-- Yandex.Metrika counter -->\n<script type=\"text/javascript\">\n (function(m,e,t,r,i,k,a){\n m[i]=m[i]||function(){(m[i].a=m[i].a||[]).push(arguments)};\n m[i].l=1*new Date();\n k=e.createElement(t),a=e.getElementsByTagName(t)[0],k.async=1,k.src=r,a.parentNode.insertBefore(k,a)\n })(window, document,'script','//mc.webvisor.org/metrika/tag_ww.js', 'ym');\n\n ym(98905589, 'init', {accurateTrackBounce:true, trackLinks:true, webvisor:true, trackHash:true, clickmap:true, ecommerce:\"dataLayer\", params: {__ym: {isFromApi: 'yesIsFromApi'}}});\n</script>\n<noscript><div><img src=\"https://mc.yandex.ru/watch/98905589\" style=\"position:absolute; left:-9999px;\" alt=\"\" /></div></noscript>\n<!-- /Yandex.Metrika counter -->\n\n\n",
|
|
"monitoring": {
|
|
"enable_monitoring": 0,
|
|
"emails": [],
|
|
"sms_allowed": 1,
|
|
"enable_sms": 0,
|
|
"phones": [],
|
|
"phone_ids": [],
|
|
"possible_phones": [
|
|
"+37544*****91"
|
|
],
|
|
"possible_phone_ids": [
|
|
598854008
|
|
]
|
|
},
|
|
"filter_robots": 2,
|
|
"currency": 643,
|
|
"currency_code": "RUB",
|
|
"visit_threshold": 1800,
|
|
"max_goals": 200,
|
|
"max_operations": 30,
|
|
"max_filters": 30,
|
|
"features": [
|
|
"webvisor2"
|
|
],
|
|
"site": "openintegrations.dev",
|
|
"site2": {
|
|
"site": "openintegrations.dev",
|
|
"domain": "openintegrations.dev"
|
|
},
|
|
"gdpr_agreement_accepted": 1,
|
|
"autogoals_enabled": true
|
|
}
|
|
}
|
|
```
|