---
metadata:
  - name: generator
    content: Diplodoc Platform v5.50.6
alternate:
  - https://yandex.com.tr/support/metrica/en/code/ajax-flash.md
  - https://yandex.com.tr/support/metrica/es/code/ajax-flash.md
  - https://yandex.com.tr/support/metrica/pt/code/ajax-flash.md
  - https://yandex.com.tr/support/metrica/ru/code/ajax-flash.md
  - https://yandex.com.tr/support/metrica/tr/code/ajax-flash.md
---
> **Documentation Index:** Fetch the complete configuration index at https://yandex.com.tr/support/metrica/en/llms.txt

# Installing and configuring a tag for AJAX and Flash sites

<!-- source: en/_includes/code/counter-initialize/id-counter-initialize/rest-js.md -->
{% note warning %}

Working with the JavaScript API requires knowledge of HTML and JavaScript. If you don’t know these languages, contact your website developer or webmaster.

{% endnote %}
<!-- endsource: en/_includes/code/counter-initialize/id-counter-initialize/rest-js.md -->


tagRead these instructions if you have an AJAX or Flash site and wish to use Yandex Metrica:

1. [Create and install the tag code on your site](https://yandex.com.tr/support/metrica/en/quick-start.md), if it is not yet installed.
1. To make sure Yandex Metrica registers important page changes, analyze the logic of your site and insert the [hit](https://yandex.com.tr/support/metrica/en/objects/hit.md) function in the appropriate parts of your AJAX and Flash code so that it's called each time you believe the page has changed.

```javascript
ym(XXXXXXXX, 'hit', [url[, options]])
```

<!-- source: en/_includes/objects/hit/id-hit/hit-params.md -->
#|
||
**Parameter**
|
**Default value**
|
**Type**
|
**Description**
||
||
`url`
|
—
|
String
|
The URL of the page from which the view was made. If the URL isn't provided, the value from [`window.location.href`](https://yandex.com.tr/support/metrica/en/data/visit-params-example.md#goal)
||
||
`options`
|
—
|
Object
|
—
||
||
`options` fields
|
>
|
>
|
>
||
||
`options.callback`
|
—
|
Function
|
The callback function to call after sending pageview data
||
||
`options.ctx`
|
—
|
Object
|
Context accessed by the `this` keyword in the callback function
||
||
`options.params`
|
—
|
Object
|
Session parameters
||
||
`options.referer`
|
—
|
String
|
The URL that the user loaded the current page contents from
||
||
`options.title`
|
`document.title`
|
String
|
Title of the current page
||
||
Fields for the `options.params` object:
|
>
|
>
|
>
||
||
`order_price`
|
—
|
Double
|
[Revenue by goal](https://yandex.com.tr/support/metrica/en/objects/hit.md#price). You can set the cost in a currency or conventional units.
||
||
`currency`
|
—
|
String
|
Use this field if you want to pass the goal cost in currency. Yandex Metrica recognizes a three-letter [ISO 4217 currency code](https://www.six-group.com/en/products-services/financial-information/data-standards.html#scrollTo=currency-codes).

<!-- source: en/_includes/ecommerce/data/id-about/currency-note.md -->
If a different currency is passed, null values are sent instead of currencies and amounts.
<!-- endsource: en/_includes/ecommerce/data/id-about/currency-note.md -->
||
|#
<!-- endsource: en/_includes/objects/hit/id-hit/hit-params.md -->



{% list tabs %}

- For AJAX sites

  
  ```javascript
  ym(**XXXXXX**, 'hit', 'http://example.com#contacts', {title: 'Contacts', referer: 'http://example.com/#main'});
  ```
  

- For Adobe Flash sites:

  
  For ActionScript 2 (Flash version earlier than 9.0):
  
  ```javascript
  getURL("javascript:ym(**XXXXXX**, 'hit', url, title, referer)");
  ```
  
  For ActionScript 3 (Flash version 9.0 and later):
  
  ```javascript
  navigateToURL(new URLRequest("javascript:ym(**XXXXXX**, 'hit', url)"), "_self");
  ```

{% endlist %}


If you want to register a [goal](https://yandex.com.tr/support/metrica/en/general/goals.md) completion for a specific action on the page, use the [reachGoal](https://yandex.com.tr/support/metrica/en/objects/reachgoal.md) function.

<!-- source: en/_includes/buttons/chat-button.md -->
[Chat with us](https://yandex.com.tr/chat/#/user/036e6a02-3620-9cdc-4c5e-a34667a7379e?utm_source=spravka){.button}

<!-- source: en/_includes/styles/href-to-button.md -->

<!-- endsource: en/_includes/styles/href-to-button.md -->
<!-- endsource: en/_includes/buttons/chat-button.md -->

<!-- source: en/_includes/code/texing-button.md -->
<div class="cut-button">

{% cut "Write an email" %}

<!-- source: en/_includes/popup/id-qanda/check1.md -->
If you were unable to [independently check the tag](https://yandex.com.tr/support/metrica/en/general/check-counter.md), follow the recommendations below.
<!-- endsource: en/_includes/popup/id-qanda/check1.md -->

{% list tabs radio %}

- Data is not sent to the console

  {% include [qanda-check2-2](../_includes/popup/id-qanda/check2-2.md) %}

  {% cut "The recommendations did not help" %}


  <div style="padding: 15px;
         margin: 10px 0;
         background: #FFFFFF;
         border-radius: 10px;
         border: 1px solid var(--g-color-line-generic);">
    <iframe style="background: #FFFFFF;"
            height="700"
            width="100%"
            frameborder="0"
            src="https://forms.yandex.com.tr/surveys/1706/?&theme=Dannye v konsoli ne otpravlyayutsya&iframe=1&lang=tr">
    </iframe>
  </div>

  {% endcut %}

- There is data in the console, but the reports do not appear

  <!-- source: en/_includes/popup/id-qanda/check2-3.md -->
  This means that information is being transmitted to Yandex Metrica. However, the data might not be shown in reports for any of the following reasons:
  <!-- endsource: en/_includes/popup/id-qanda/check2-3.md -->

  <!-- source: en/_includes/popup/id-qanda/check2-4.md -->
  - Data is sent to a tag with a different number.
  - The **Filters** tab in the tag settings has overly strict filters defined. Remove unneeded filters.
  - The **Filters** tab in the tag settings has the **Don’t count my sessions** filter enabled. This means that the tag doesn't register your own sessions. Try accessing the site with your browser in “incognito” mode.
  <!-- endsource: en/_includes/popup/id-qanda/check2-4.md --> 

  {% cut "The recommendations did not help" %}


  <div style="padding: 15px;
           margin: 10px 0;
           background: #FFFFFF;
           border-radius: 10px;
           border: 1px solid var(--g-color-line-generic);">
    <iframe style="background: #FFFFFF;"
              height="700"
              width="100%"
              frameborder="0"
              src="https://forms.yandex.com.tr/surveys/1706/?&theme=Dannye v konsoli est, no otchety ne otobrazhayutsya&iframe=1&lang=tr">
    </iframe>
  </div>

  {% endcut %}

{% endlist %}

{% endcut %}

</div>

<!-- source: en/_includes/styles/cut-button.md -->

<!-- endsource: en/_includes/styles/cut-button.md -->
<!-- endsource: en/_includes/code/texing-button.md -->

<!-- source: en/_includes/footer-links.md -->
- - -

<div class="borderless-table">

#|
||
Useful links

- [Demo tag](https://metrica.yandex.com.tr/r/dashboard?)
- [Add a tag](https://metrica.yandex.com.tr/add/)
- [Free tag setup](https://yandex.com.tr/promo/freeservice/metrica?utm_source=help_metrica_tr&utm_medium=cpc&utm_campaign=1)
- [Yandex Metrica API](https://tech.yandex.com.tr/metrika/)
- [Suggest your idea](https://yandex.com.tr/support/metrica/troubleshooting/idea.html)
- [Discuss in Telegram](https://t.me/yandexmetrika)
|
Online training

- [Get a Yandex Metrica certificate](https://yandex.ru/adv/expert/exam/metrika/?utm_source=metrika_help&utm_medium=web&utm_campaign=static&utm_content=useful_links)


- [Take a training course](https://yandex.com/adv/edu/online/metrika?utm_source=metrika_help&utm_medium=web&utm_campaign=static&utm_content=useful_links)

||
|#

</div>

<!-- source: en/_includes/styles/table-style.md -->

<!-- endsource: en/_includes/styles/table-style.md -->
<!-- endsource: en/_includes/footer-links.md -->

<!-- source: en/_includes/styles/cut-button.md -->

<!-- endsource: en/_includes/styles/cut-button.md -->

<!-- source: en/_includes/styles/href-to-button.md -->

<!-- endsource: en/_includes/styles/href-to-button.md -->

{% included (../_includes/popup/id-qanda/check2-2.md) %}
   This might happen for the following reasons:
   - The tag is installed incorrectly. For example, the CMS modified the tag code. Reinstall the tag or contact the support service for your CMS.
   - Broken scripts are preventing the Yandex Metrica tag from working on the site. You can check this in the browser console.


{% endincluded %}