file
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.
Sends information about file downloads.
The data collected is used when generating File downloads reports.
ym(XXXXXX, 'file', url[, options]);
Parameter |
Default value |
Type |
Description |
|
: |
String |
URL of the uploaded file |
|
: |
Object |
: |
|
|||
|
: |
Function |
The callback function called after sending data about a file download |
|
: |
Object |
Context accessed by the |
|
: |
Object |
Session parameters |
|
: |
String |
URL that the user downloaded the file from |
|
|
String |
Title of the current page |
Fields for the |
|||
|
: |
Double |
Revenue by goal. You can set the cost in a currency or conventional units. |
|
: |
String |
Use this field if you want to pass the goal cost in currency. Yandex Metrica recognizes a three-letter ISO 4217 currency code. If a different currency is passed, null values are sent instead of currencies and amounts. |
* Required parameter.
With the url
and options.referer
parameters, you can use URL paths without a schema (protocol) and host.
In this case, if a path starts with a /
, the URL is assumed to be set from the root of the host.
ym(XXXXXX, 'file', '/downloads/price.zip');
Otherwise, the path is assumed to be relative to the current page.
ym(XXXXXX, 'file', '../downloads/price.zip', {referer: 'index.html?page=goods'});
Revenue by goal
If file download is one of the goals set on your website, you can transmit the revenue in the method parameters. Details about revenue by goal
Example:
var goalParams =
{
order_price: 1000.35,
currency: "RUB"
};
ym(XXXXXX, 'file', '../downloads/price.zip', goalParams)
Useful links |
Online training |
* Required parameter.