{"_id":"577180b22d37b20e00c845a7","project":"568af724176a6c0d00a29ec4","editedParams2":true,"parentDoc":null,"user":"568af6d197d8960d0012ab7d","__v":1,"version":{"_id":"568af725176a6c0d00a29ec7","project":"568af724176a6c0d00a29ec4","__v":11,"createdAt":"2016-01-04T22:50:13.289Z","releaseDate":"2016-01-04T22:50:13.289Z","categories":["568af725176a6c0d00a29ec8","56d9d397337fd11300d6a3e3","56d9d4287222d50b0070160b","56f424307ea0091700f63ac5","56f45babcb0dce29005a8e85","5739e5836c5ba134007a197d","57717aee3dd24019004c9122","5771b5d8c755ca0e00617d7d","579639964913990e001a5911","57e57e7df3d7fc0e009c5119","587569b6f4483a0f00d2e6b8"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"1.0.0","version":"1.0"},"category":{"_id":"57717aee3dd24019004c9122","project":"568af724176a6c0d00a29ec4","version":"568af725176a6c0d00a29ec7","__v":0,"sync":{"url":"","isSync":false},"reference":false,"createdAt":"2016-06-27T19:13:50.805Z","from_sync":false,"order":5,"slug":"reporting","title":"Reporting"},"editedParams":true,"updates":[],"next":{"pages":[],"description":""},"createdAt":"2016-06-27T19:38:26.163Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"examples":{"codes":[{"code":"<?php\n$ch = curl_init(\"https://rest.viglink.com/api/metrics?startDate=2016-01-01&endDate=2016-01-31\");\n\ncurl_setopt($ch, CURLOPT_HTTPHEADER, array('Authorization: secret YOUR SECRET KEY'));\n\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);\n\n$response = curl_exec($ch);\n\ncurl_close($ch);","language":"php"},{"code":"require 'httparty'\n\nurl = \"https://rest.viglink.com/api/metrics?startDate=2016-01-01&endDate=2016-01-31\"\n\nheaders = {Authorization: \"secret {SECRET KEY}\"}\n\nresponse = HTTParty.get(url, headers: headers)","language":"ruby"},{"code":"curl -i -X GET -H \"Authorization: secret {SECRET KEY}\" 'https://rest.viglink.com/api/metrics?startDate=2016-01-01&endDate=2016-01-31'","language":"curl"}]},"method":"get","results":{"codes":[{"name":"","code":"{\n    \"queryProfile\": {\n        \"accountId\": 1234567,\n        \"currency\": \"USD\",\n        \"startDate\": \"2016-01-01\",\n        \"endDate\": \"2016-01-31\",\n        \"compareStartDate\": \"2015-12-01\",\n        \"compareEndDate\": \"2015-12-31\",\n        \"campaignId\":null,\n        \"product\":null,\n        \"device\":null,\n        \"compare\":true\n    },\n    \"metrics\": {\n        \"revenue\": {\n            value: 20145.82,\n            compareValue: 19982.93,\n            delta: 0.81514572687789,\n            deltaDir: \"up\",\n            outcome: \"positive\"\n        },\n        \"epc\": {\n            value: 0.091528225165262,\n            compareValue: 0.10196621014818,\n            delta: -10.236709756841,\n            deltaDir: \"down\",\n            outcome: \"negative\"\n        },\n        \"clicks\": {\n            value: 220105,\n            compareValue: 195976,\n            delta: 12.312221904723,\n            deltaDir: \"up\",\n            outcome: \"positive\"\n        },\n        \"sales\": {\n            value: 178689.7,\n            compareValue: 212059.35,\n            delta: -15.73599560689,\n            deltaDir: \"down\",\n            outcome: \"negative\"\n        },\n        \"ctr\": {\n            value: 0.19786807342966,\n            compareValue: 0.20414314670448,\n            delta: -3.0738593854929,\n            deltaDir: \"down\",\n            outcome: \"negative\"\n        },\n        \"pageviews\": {\n            value: 111238259,\n            compareValue: 95999304,\n            delta: 15.874026545026,\n            deltaDir: \"up\",\n            outcome: \"positive\"\n        }\n    }\n}","language":"json","status":200},{"name":null,"code":"{\n    \"error\": {\n        \"errors\": [\n            {\n                \"reason\": \"invalidParameter\",\n                \"message\": \"Invalid product requested. Please use all, convert, insert, spotlight\",\n                \"locationType\": \"parameter\",\n                \"location\": \"product\"\n            }\n        ]\n    },\n    \"code\": 400,\n    \"message\": \"Invalid product requested. Please use all, convert, insert, spotlight\"\n}","language":"json","status":400},{"status":401,"language":"json","code":"{\n    \"error\": {\n        \"errors\": [\n            {\n                \"reason\": \"invalidCredentials\",\n                \"message\": \"Authorization secret is missing or invalid. This can be found at https://publishers.viglink.com/account and can be sent as a parameter or Authorization header\",\n                \"locationType\": \"parameter\",\n                \"location\": \"secret\"\n            }\n        ]\n    },\n    \"code\": 401,\n    \"message\": \"Authorization secret is missing or invalid. This can be found at https://publishers.viglink.com/account and can be sent as a parameter or Authorization header\"\n}"},{"code":"{\n    \"error\": {\n        \"errors\": [\n            {\n                \"reason\": \"internalServerError\",\n                \"message\": \"An unexpected error occurred, but we are looking into it\"\n            }\n        ]\n    },\n    \"code\": 500,\n    \"message\": \"An unexpected error occurred, but we are looking into it\"\n}","language":"text","status":500}]},"settings":"57717d5327a5c20e00030dbd","auth":"required","params":[{"_id":"577180b22d37b20e00c845a9","ref":"","in":"query","required":false,"desc":"Numeric ID of your campaign(s)","default":"NULL","type":"array_int","name":"campaignId"},{"_id":"577180b22d37b20e00c845a8","ref":"","in":"query","required":false,"desc":"Lowercase instance of a product (all, convert, insert or spotlight)","default":"NULL","type":"array_string","name":"product"},{"_id":"577181be2f16442900771117","ref":"","in":"query","required":false,"desc":"Lowercase device type (all, unknown, desktop, tablet, mobile)","default":"NULL","type":"array_string","name":"device"},{"_id":"577181be2f16442900771116","ref":"","in":"query","required":false,"desc":"Start of requested time series","default":"-31 Days","type":"yyyy-mm-dd","name":"startDate"},{"_id":"577181be2f16442900771115","ref":"","in":"query","required":false,"desc":"End of requested time series","default":"-1 Day","type":"yyyy-mm-dd","name":"endDate"},{"_id":"577181be2f16442900771114","ref":"","in":"query","required":false,"desc":"Automatically compare metrics to adjacent time range and calculate difference in metrics","default":"false","type":"boolean","name":"compare"},{"_id":"577181be2f16442900771113","ref":"","in":"query","required":false,"desc":"Lowercase format of response: json, xml or csv","default":"json","type":"string","name":"format"},{"_id":"577181be2f16442900771112","ref":"","in":"query","required":false,"desc":"JSON-P callback method name","default":"NULL","type":"string","name":"callback"}],"url":"/metrics"},"isReference":false,"order":0,"body":"[block:callout]\n{\n  \"type\": \"warning\",\n  \"title\": \"Authorization Header\",\n  \"body\": \"You must add authorization headers to this request.\\n```Authorization: secret {SECRET KEY}```\\n\\n<b>Replace {SECRET KEY} above with any secret key from any campaign in your account.</b> You can find a secret key in your [VigLink account](https://publishers.viglink.com/account). When logged into your dashboard, go to Manage > Account. Under the My Campaign sub-heading, copy a Secret Key. If you don’t have one, click “Get a Secret Key\\\" on any of your campaigns.\"\n}\n[/block]\nRevenue, EPC, Clicks, Sales, CTR and Pageviews are aggregated in this endpoint. For the VigLink dashboard, we use the same endpoint to display your performance for the selected options campaignId, product, device, etc.\n\nTo get change in values and percentages, the `compare` parameter must be sent as `true`.\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/fXPpSatTyukhGgesle9A_metrics.png\",\n        \"metrics.png\",\n        \"959\",\n        \"116\",\n        \"#79a1d2\",\n        \"\"\n      ]\n    }\n  ]\n}\n[/block]\n##Metrics\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Metric\",\n    \"h-1\": \"dataType\",\n    \"h-2\": \"Description\",\n    \"0-0\": \"revenue\",\n    \"0-1\": \"`CURRENCY`\",\n    \"0-2\": \"Your commissions or revenue, after VigLink's share. These commissions are still subject to returns and adjustments.\",\n    \"1-0\": \"epc\",\n    \"1-1\": \"`CURRENCY`\",\n    \"1-2\": \"Earnings per click. This is calculated by clicks / revenue.\",\n    \"2-0\": \"clicks\",\n    \"2-1\": \"`INTEGER`\",\n    \"2-2\": \"Only clicks that are considered affiliatable are counted toward this metric.\",\n    \"3-0\": \"sales\",\n    \"3-1\": \"`CURRENCY`\",\n    \"3-2\": \"Gross sales generated for all merchants from your affiliate clicks.\",\n    \"4-0\": \"ctr\",\n    \"4-1\": \"`PERCENT`\",\n    \"4-2\": \"Click-through Rate. This calculated by clicks / pageviews * 100.\",\n    \"5-0\": \"sales\",\n    \"5-1\": \"`CURRENCY`\",\n    \"5-2\": \"Gross sales generated for all merchants from your affiliate clicks.\"\n  },\n  \"cols\": 3,\n  \"rows\": 6\n}\n[/block]\n##Query Profile\n\nA `queryProfile` index is returned to provide insight into changed parameters (if invalid), default parameters used for the report and additional account data returned from the request.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"\\\"queryProfile\\\": {\\n    \\\"accountId\\\": 1234567,\\n    \\\"currency\\\": \\\"USD\\\",\\n    \\\"startDate\\\": \\\"2016-01-01\\\",\\n    \\\"endDate\\\": \\\"2016-01-31\\\",\\n    \\\"compareStartDate\\\": \\\"2015-12-01\\\",\\n    \\\"compareEndDate\\\": \\\"2015-12-31\\\",\\n    \\\"campaignId\\\":null,\\n    \\\"product\\\":null,\\n    \\\"device\\\":null,\\n    \\\"compare\\\":true\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\n##Comparisons and Delta\n\nWhen `compare` is set to `TRUE` for this endpoint, each metric returned includes additional properties to describe its variance compared to the adjacent `compareStartDate` and `compareEndDate` range requested. Below is an explanation of each property:\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Property\",\n    \"h-1\": \"Default\",\n    \"h-2\": \"Possible Values\",\n    \"h-3\": \"Description\",\n    \"0-0\": \"value\",\n    \"0-1\": \"0\",\n    \"0-2\": \"Integer or Float\",\n    \"0-3\": \"Value for the metric for the current date range\",\n    \"1-0\": \"compareValue\",\n    \"2-0\": \"delta\",\n    \"3-0\": \"deltaDir\",\n    \"4-0\": \"outcome\",\n    \"1-1\": \"0\",\n    \"2-1\": \"0\",\n    \"3-1\": \"up\",\n    \"4-1\": \"positive\",\n    \"1-2\": \"Integer or Float\",\n    \"1-3\": \"Value for the same metric for the adjacent date range\",\n    \"2-2\": \"((value - compareValue) / value) * 100\\n\\nor 100 if the compareValue is 0 and value is > 0\",\n    \"2-3\": \"The calculated percentage difference between the current value and compared value\",\n    \"3-2\": \"up, down, infinity, neutral\",\n    \"3-3\": \"When there is no change between values, neutral is returned. When the compareValue is 0, but the value is > 0 infin is returned. For all other calculations, up or down is returned.\",\n    \"4-2\": \"positive, negative, neutral\",\n    \"4-3\": \"A evaluation of the outcome of a value change. Sometimes, lower is better (bounce rate) and this property reflects that indicator.\"\n  },\n  \"cols\": 4,\n  \"rows\": 5\n}\n[/block]","excerpt":"Get the aggregated metrics for your campaigns.","slug":"metrics","type":"endpoint","title":"Aggregated Metrics"}

getAggregated Metrics

Get the aggregated metrics for your campaigns.

Definition

{{ api_url }}{{ page_api_url }}

Parameters

Query Params

campaignId:
array of integersNULL
Numeric ID of your campaign(s)
product:
array of stringsNULL
Lowercase instance of a product (all, convert, insert or spotlight)
device:
array of stringsNULL
Lowercase device type (all, unknown, desktop, tablet, mobile)
startDate:
yyyy-mm-dd-31 Days
Start of requested time series
endDate:
yyyy-mm-dd-1 Day
End of requested time series
compare:
booleanfalse
Automatically compare metrics to adjacent time range and calculate difference in metrics
format:
stringjson
Lowercase format of response: json, xml or csv
callback:
stringNULL
JSON-P callback method name

Examples


Result Format


Documentation

[block:callout] { "type": "warning", "title": "Authorization Header", "body": "You must add authorization headers to this request.\n```Authorization: secret {SECRET KEY}```\n\n<b>Replace {SECRET KEY} above with any secret key from any campaign in your account.</b> You can find a secret key in your [VigLink account](https://publishers.viglink.com/account). When logged into your dashboard, go to Manage > Account. Under the My Campaign sub-heading, copy a Secret Key. If you don’t have one, click “Get a Secret Key\" on any of your campaigns." } [/block] Revenue, EPC, Clicks, Sales, CTR and Pageviews are aggregated in this endpoint. For the VigLink dashboard, we use the same endpoint to display your performance for the selected options campaignId, product, device, etc. To get change in values and percentages, the `compare` parameter must be sent as `true`. [block:image] { "images": [ { "image": [ "https://files.readme.io/fXPpSatTyukhGgesle9A_metrics.png", "metrics.png", "959", "116", "#79a1d2", "" ] } ] } [/block] ##Metrics [block:parameters] { "data": { "h-0": "Metric", "h-1": "dataType", "h-2": "Description", "0-0": "revenue", "0-1": "`CURRENCY`", "0-2": "Your commissions or revenue, after VigLink's share. These commissions are still subject to returns and adjustments.", "1-0": "epc", "1-1": "`CURRENCY`", "1-2": "Earnings per click. This is calculated by clicks / revenue.", "2-0": "clicks", "2-1": "`INTEGER`", "2-2": "Only clicks that are considered affiliatable are counted toward this metric.", "3-0": "sales", "3-1": "`CURRENCY`", "3-2": "Gross sales generated for all merchants from your affiliate clicks.", "4-0": "ctr", "4-1": "`PERCENT`", "4-2": "Click-through Rate. This calculated by clicks / pageviews * 100.", "5-0": "sales", "5-1": "`CURRENCY`", "5-2": "Gross sales generated for all merchants from your affiliate clicks." }, "cols": 3, "rows": 6 } [/block] ##Query Profile A `queryProfile` index is returned to provide insight into changed parameters (if invalid), default parameters used for the report and additional account data returned from the request. [block:code] { "codes": [ { "code": "\"queryProfile\": {\n \"accountId\": 1234567,\n \"currency\": \"USD\",\n \"startDate\": \"2016-01-01\",\n \"endDate\": \"2016-01-31\",\n \"compareStartDate\": \"2015-12-01\",\n \"compareEndDate\": \"2015-12-31\",\n \"campaignId\":null,\n \"product\":null,\n \"device\":null,\n \"compare\":true\n}", "language": "json" } ] } [/block] ##Comparisons and Delta When `compare` is set to `TRUE` for this endpoint, each metric returned includes additional properties to describe its variance compared to the adjacent `compareStartDate` and `compareEndDate` range requested. Below is an explanation of each property: [block:parameters] { "data": { "h-0": "Property", "h-1": "Default", "h-2": "Possible Values", "h-3": "Description", "0-0": "value", "0-1": "0", "0-2": "Integer or Float", "0-3": "Value for the metric for the current date range", "1-0": "compareValue", "2-0": "delta", "3-0": "deltaDir", "4-0": "outcome", "1-1": "0", "2-1": "0", "3-1": "up", "4-1": "positive", "1-2": "Integer or Float", "1-3": "Value for the same metric for the adjacent date range", "2-2": "((value - compareValue) / value) * 100\n\nor 100 if the compareValue is 0 and value is > 0", "2-3": "The calculated percentage difference between the current value and compared value", "3-2": "up, down, infinity, neutral", "3-3": "When there is no change between values, neutral is returned. When the compareValue is 0, but the value is > 0 infin is returned. For all other calculations, up or down is returned.", "4-2": "positive, negative, neutral", "4-3": "A evaluation of the outcome of a value change. Sometimes, lower is better (bounce rate) and this property reflects that indicator." }, "cols": 4, "rows": 5 } [/block]

User Information

Try It Out

get
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}