I've been using youtube analytics API to fetch different reports, but since some days ago the api is not returning complete data, but only until 3 days before the current date.
The following is a request for video views report from 2020-04-20 until 2020-04-28, but the response returns data only until 2020-04-25, but I can see in my channel that we have video views in the dates 2020-04-26 and 2020-04-27.
'https://youtubeanalytics.googleapis.com/v2/reports?dimensions=day%2CinsightTrafficSourceType&endDate=2020-04-28&filters=video%3D%3DoQqVWPfSfe8&ids=channel%3D%3DMINE&metrics=views%2CestimatedMinutesWatched&sort=day%2C-views&startDate=2020-04-20&key=[YOUR_API_KEY]' \
--header 'Authorization: Bearer [YOUR_ACCESS_TOKEN]' \
--header 'Accept: application/json' \
--compressed
Response:
{
"kind": "youtubeAnalytics#resultTable",
"columnHeaders": [
{
"name": "day",
"columnType": "DIMENSION",
"dataType": "STRING"
},
{
"name": "insightTrafficSourceType",
"columnType": "DIMENSION",
"dataType": "STRING"
},
{
"name": "views",
"columnType": "METRIC",
"dataType": "INTEGER"
},
{
"name": "estimatedMinutesWatched",
"columnType": "METRIC",
"dataType": "INTEGER"
}
],
"rows": [
[
"2020-04-20",
"ADVERTISING",
23429,
12417
],
[
"2020-04-20",
"NO_LINK_OTHER",
31,
5
],
[
"2020-04-20",
"EXT_URL",
5,
0
],
[
"2020-04-21",
"ADVERTISING",
46469,
24522
],
[
"2020-04-21",
"NO_LINK_OTHER",
54,
9
],
[
"2020-04-21",
"EXT_URL",
5,
1
],
[
"2020-04-22",
"ADVERTISING",
40020,
21132
],
[
"2020-04-22",
"NO_LINK_OTHER",
43,
9
],
[
"2020-04-22",
"EXT_URL",
7,
2
],
[
"2020-04-23",
"ADVERTISING",
22944,
12127
],
[
"2020-04-23",
"NO_LINK_OTHER",
32,
6
],
[
"2020-04-23",
"EXT_URL",
3,
0
],
[
"2020-04-24",
"ADVERTISING",
8549,
4524
],
[
"2020-04-24",
"NO_LINK_OTHER",
42,
9
],
[
"2020-04-24",
"EXT_URL",
7,
3
],
[
"2020-04-25",
"ADVERTISING",
820,
432
],
[
"2020-04-25",
"NO_LINK_OTHER",
30,
3
],
[
"2020-04-25",
"EXT_URL",
8,
1
]
]
}
Has something changed in the API? any new restrictions?
Thank you for your support.
I have a timeseries data which I am trying to display with Highstocks:
Here is the data:
{
"title": {
"text": "My Graph"
},
"series": [
[
{
"name": "Future Index Longs",
"data": [
[
"2019-02-05",
104516
],
[
"2019-02-06",
127260
],
[
"2019-02-07",
156291
],
[
"2019-02-08",
167567
]
]
}
],
[
{
"name": "Future Index Longs",
"data": [
[
"2019-02-05",
21
],
[
"2019-02-06",
0
],
[
"2019-02-07",
1263
],
[
"2019-02-08",
12
]
]
}
],
[
{
"name": "Future Index Longs",
"data": [
[
"2019-02-05",
33873
],
[
"2019-02-06",
61093
],
[
"2019-02-07",
43125
],
[
"2019-02-08",
41928
]
]
}
],
[
{
"name": "Future Index Longs",
"data": [
[
"2019-02-05",
47542
],
[
"2019-02-06",
55084
],
[
"2019-02-07",
75256
],
[
"2019-02-08",
77786
]
]
}
],
[
{
"name": "Future Index Longs",
"data": [
[
"2019-02-05",
185952
],
[
"2019-02-06",
243437
],
[
"2019-02-07",
275935
],
[
"2019-02-08",
287293
]
]
}
]
]
}
The graph is empty and no data is displayed. What am I doing wrong?
Sorry to add this filler here but I am required to add more text to post this question and since this is a pretty simple question, I don't have much to add.
You have the wrong format on your series, it should be an array of objects.
Like this: series: [{ ... }, { ... }]
Check this fiddle: https://jsfiddle.net/wg1vnyzp/1/
To have a chart with datetime axes in Highcharts you have to pass the X value as the timestamp in milliseconds since 1970.
Highstock example:
https://jsfiddle.net/BlackLabel/f0rsz6cd/1/
Note that in Highcharts you have to define xAxis.type as datetime like that:
xAxis: {
type: 'datetime'
}
Highcharts demo:
https://jsfiddle.net/BlackLabel/kas2oywp/
API reference:
https://api.highcharts.com/highcharts/series.line.data.x
https://api.highcharts.com/highcharts/xAxis.type
We have Google Analytics with Google Tag Manager running in 3 of our other iOS apps but for some reason this latest app is crashing upon trying to open the container.
Here's the line of code in question (similar to GTM's guidelines):
NSTimeInterval timeout = 0.1;
[TAGContainerOpener openContainerWithId:containerName
tagManager:_tagManager
openType:kTAGOpenTypePreferNonDefault
timeout:&timeout
notifier:self];
The error thrown:
Terminating app due to uncaught exception 'NSParseErrorException',
reason: 'Last tag: 116 should be 124'
Stack trace:
*** First throw call stack:
(
0 CoreFoundation 0x0000000104dffa75 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x0000000104716bb7 objc_exception_throw + 45
2 CoreFoundation 0x0000000104dff9ad +[NSException raise:format:] + 205
3 MyApp 0x0000000102831ce6 -[TAGPBCodedInputStream readUnknownGroup:builder:] + 152
4 MyApp 0x0000000102844904 -[TAGPBUnknownFieldSet mergeFieldFrom:input:] + 283
5 MyApp 0x000000010283ceb1 -[TAGPBGeneratedMessage parseUnknownField:extensionRegistry:tag:] + 203
6 MyApp 0x000000010283cfc8 -[TAGPBGeneratedMessage mergeFromCodedInputStream:extensionRegistry:] + 264
7 MyApp 0x000000010283cb35 -[TAGPBGeneratedMessage mergeFromData:extensionRegistry:] + 88
8 MyApp 0x000000010283cc1e +[TAGPBGeneratedMessage parseFromData:extensionRegistry:] + 82
9 MyApp 0x0000000102852da7 -[TAGResourceStorageImpl loadResourceFromContainerFile:] + 352
10 MyApp 0x000000010284d245 -[TAGContainer createInitialContainer] + 89
11 MyApp 0x000000010284afd3 -[TAGContainer initWithId:tagManager:resourceStorage:] + 399
12 MyApp 0x000000010284b098 -[TAGContainer initWithId:tagManager:] + 112
13 MyApp 0x000000010284ffe5 -[TAGManager containerById:] + 64
14 MyApp 0x000000010284f618 -[TAGManager openContainerById:callback:] + 258
15 MyApp 0x000000010284e9d3 -[TAGContainerOpener openWithRefreshType:] + 850
16 MyApp 0x000000010284e5c5 +[TAGContainerOpener openContainerWithId:tagManager:openType:timeout:notifier:] + 155
17 MyApp 0x0000000102812588 -[AnalyticsManager initWithTrackingId:containerName:] + 776
18 MyApp 0x00000001027b5afe -[TIXAppDelegate setupAnalytics] + 94
I can't seem to find any info scouring the web so far. The only thing I've seen so far is a mention in GA's Release notes that they've deprecated openContainerWithId possibly but their current guide says nothing about this or what to use instead.
Here's the container file contents:
{
"exportFormatVersion": 1.3,
"exportTime": "2015-06-23 16:11:59",
"containerVersion": {
"accountId": "197720",
"containerId": "1300316",
"containerVersionId": "0",
"deleted": false,
"container": {
"accountId": "197720",
"containerId": "1300316",
"name": "App",
"publicId": "GTM-MYCONTAINER",
"timeZoneCountryId": "US",
"timeZoneId": "America/Los_Angeles",
"notes": "",
"usageContext": [
"IOS"
],
"fingerprint": "1434997566330",
"enabledBuiltInVariable": [
"EVENT",
"APP_ID",
"APP_NAME",
"APP_VERSION_CODE",
"APP_VERSION_NAME"
]
},
"fingerprint": "0",
"variable": [
{
"accountId": "197720",
"containerId": "1300316",
"variableId": "1",
"name": "UA Number",
"type": "c",
"parameter": [
{
"type": "TEMPLATE",
"key": "value",
"value": "UA-TrackingNumber"
}
],
"fingerprint": "0"
},
{
"accountId": "197720",
"containerId": "1300316",
"variableId": "3",
"name": "screen-from",
"type": "v",
"parameter": [
{
"type": "TEMPLATE",
"key": "name",
"value": "screen-from"
}
],
"fingerprint": "0"
},
{
"accountId": "197720",
"containerId": "1300316",
"variableId": "2",
"name": "screen-name",
"type": "v",
"parameter": [
{
"type": "TEMPLATE",
"key": "name",
"value": "screen-name"
}
],
"fingerprint": "0"
},
{
"accountId": "197720",
"containerId": "1300316",
"variableId": "4",
"name": "view-name",
"type": "v",
"parameter": [
{
"type": "TEMPLATE",
"key": "name",
"value": "view-name"
}
],
"fingerprint": "0"
}
]
}
}
Any help appreciated.
It turns out, this issue can happen if no actual tags have been created on the server end of Google Tag manager.
Our analytics guy ended up doing the following:
1. Creating the needed tags on the server
2. Generating a new container file which we update in our code
Then the crash went away and everything worked.
I am getting into Highcharts little by little i am stuck at an aparently simple problem...
I have an area chart with 2 series.
$(function() {
$('#grafico3a').highcharts('StockChart', {
chart: {
type: 'area'
},
series: [{
name: 'Series1',
data: Series1,
}, {
name: 'Series2',
data: Series2,
}
]
});
});
the data file is this:
var Series1 = [
[Date.UTC(2003,8 ,24, 0 ), 243 ],
[Date.UTC(2003,8 ,24, 1 ), 21 ],
[Date.UTC(2003,8 ,24, 2 ), 377 ],
[Date.UTC(2003,8 ,24, 3 ), 70 ],
];
var Series2 = [
[Date.UTC(2003,8 ,24, 0 ), 2880 ],
[Date.UTC(2003,8 ,24, 1 ), 3460 ],
[Date.UTC(2003,8 ,24, 2 ), 3090 ],
[Date.UTC(2003,8 ,24, 3 ), 980 ],
];
It works perfectly but now i am trying to change it so to read series from single lines.. something like this:
var Series = [
[Date.UTC(2003,8 ,24, 0 ), 243, 2880 ],
[Date.UTC(2003,8 ,24, 1 ), 21, 3460 ],
[Date.UTC(2003,8 ,24, 2 ), 377, 3090 ],
[Date.UTC(2003,8 ,24, 3 ), 70, 980 ],
];
Probably it is very simple but i cannot make it work!!
Can anyone help me, please???
Thanks!
Peter.
I've been working on older code written for Highcharts 2.x. It was working fine with 3.0 but when moving to 4.0 we saw this weird behavior:
http://jsfiddle.net/pfofo973/2/
As you can see, each period on the X axis has two stacked columns. The problem is that the first column isn't touching the X axis but has some kind of padding below it. Any idea how to correct that?
Thanks!
Here is the JS code:
chart = new Highcharts.Chart({
"chart": {
"renderTo": "container",
"defaultSeriesType": "column",
"marginTop": 100,
"marginBottom": 20,
"zoomType": "x",
"spacingRight": 20
},
"title": {
"text": "Activity Overview"
},
"subtitle": {
"text": "Grouped per week"
},
"xAxis": {
"type": "datetime",
"tickInterval": 604800000,
"tickWidth": 0,
"maxZoom": 1209600000,
"x": -30,
"labels": {}
},
"yAxis": [
{
"title": {
"text": "Days"
},
"endOnTick": false,
"maxPadding": 1,
"categories": [],
"index": 0
},
{
"gridLineWidth": 0,
"maxPadding": 1,
"categories": [],
"title": {
"text": "Number",
"style": {
"color": "#AA4643"
}
},
"labels": {
"style": {
"color": "#AA4643"
}
},
"opposite": true,
"index": 1
},
{
"gridLineWidth": 0,
"maxPadding": 0.8,
"endOnTick": false,
"lineWidth": 0,
"categories": [],
"opposite": true,
"tickLength": 0,
"max": 300,
"title": {
"text": ""
},
"labels": {
"text": ""
},
"index": 2
},
{
"gridLineWidth": 0,
"endOnTick": false,
"minPadding": 6,
"maxPadding": 0.5,
"lineWidth": 0,
"opposite": true,
"tickLength": 0,
"max": 100,
"min": 50,
"categories": [],
"title": {
"text": ""
},
"labels": {
"text": ""
},
"index": 3
}
],
"legend": {
"align": "left",
"verticalAlign": "top",
"y": 40,
"floating": true,
"borderWidth": 0
},
"tooltip": {
"shared": true,
"crosshairs": true,
"useHTML": true
},
"plotOptions": {
"column": {
"stacking": "normal"
},
"spline": {
"lineWidth": 1,
"dashStyle": "ShortDot",
"marker": {
"enabled": false,
"states": {
"hover": {
"enabled": true,
"radius": 4
}
}
}
}
},
"series": [
{
"name": "c1",
"stack": "survey",
"yAxis": 0,
"data": [
[
1406444400000,
7.3
],
[
1407049200000,
8.2
],
[
1407654000000,
7.8
],
[
1408258800000,
8.9
],
[
1408863600000,
6.7
],
[
1409468400000,
8
],
[
1410073200000,
8.4
],
[
1410678000000,
6.5
],
[
1411282800000,
6.6
],
[
1411887600000,
4.9
],
[
1412492400000,
1.8
]
],
"_colorIndex": 0
},
{
"name": "R1",
"stack": "survey",
"yAxis": 0,
"data": [
[
1406444400000,
4.2
],
[
1407049200000,
3.9
],
[
1407654000000,
3.9
],
[
1408258800000,
5.3
],
[
1408863600000,
3.2
],
[
1409468400000,
4.4
],
[
1410073200000,
3.1
],
[
1410678000000,
2.8
],
[
1411282800000,
2.8
],
[
1411887600000,
2.2
],
[
1412492400000,
0.9
]
],
"_colorIndex": 1
},
{
"name": "A1",
"stack": "survey",
"yAxis": 0,
"data": [
[
1406444400000,
1.8
],
[
1407049200000,
1.7
],
[
1407654000000,
1.5
],
[
1408258800000,
0.9
],
[
1408863600000,
1.7
],
[
1409468400000,
1.3
],
[
1410073200000,
1.3
],
[
1410678000000,
1.9
],
[
1411282800000,
1.2
],
[
1411887600000,
1.2
],
[
1412492400000,
0.4
]
],
"_colorIndex": 2
},
{
"name": "Nb R",
"type": "spline",
"color": "#AA4643",
"yAxis": 1,
"data": [
[
1406444400000,
3.7
],
[
1407049200000,
3.8
],
[
1407654000000,
4.1
],
[
1408258800000,
4.1
],
[
1408863600000,
3.6
],
[
1409468400000,
3.8
],
[
1410073200000,
3.8
],
[
1410678000000,
3.5
],
[
1411282800000,
3.8
],
[
1411887600000,
3.3
],
[
1412492400000,
3.1
]
],
"_symbolIndex": 0
},
{
"name": "P",
"stack": "rater",
"stacking": "percent",
"color": "#64E572",
"yAxis": 2,
"showInLegend": false,
"data": [
[
1406444400000,
34.55
],
[
1407049200000,
23.84
],
[
1407654000000,
38.58
],
[
1408258800000,
27.78
],
[
1408863600000,
34.07
],
[
1409468400000,
33.75
],
[
1410073200000,
38.71
],
[
1410678000000,
38.07
],
[
1411282800000,
31.35
],
[
1411887600000,
27.95
],
[
1412492400000,
30
]
]
},
{
"name": "S",
"stack": "rater",
"stacking": "percent",
"color": "#508432",
"yAxis": 2,
"showInLegend": false,
"data": [
[
1406444400000,
49.09
],
[
1407049200000,
49.01
],
[
1407654000000,
44.67
],
[
1408258800000,
50.56
],
[
1408863600000,
49.12
],
[
1409468400000,
51.25
],
[
1410073200000,
46.08
],
[
1410678000000,
42.64
],
[
1411282800000,
51.89
],
[
1411887600000,
56.52
],
[
1412492400000,
61.67
]
]
},
{
"name": "Su",
"stack": "rater",
"stacking": "percent",
"color": "#058DC7",
"yAxis": 2,
"showInLegend": false,
"data": [
[
1406444400000,
3.64
],
[
1407049200000,
4.64
],
[
1407654000000,
1.52
],
[
1408258800000,
7.22
],
[
1408863600000,
3.98
],
[
1409468400000,
3.75
],
[
1410073200000,
0.92
],
[
1410678000000,
3.55
],
[
1411282800000,
3.24
],
[
1411887600000,
2.48
],
[
1412492400000,
3.33
]
]
},
{
"name": "F",
"stack": "rater",
"stacking": "percent",
"color": "#24CBE5",
"yAxis": 2,
"showInLegend": false,
"data": [
[
1406444400000,
6.36
],
[
1407049200000,
10.6
],
[
1407654000000,
8.63
],
[
1408258800000,
6.11
],
[
1408863600000,
3.54
],
[
1409468400000,
3.13
],
[
1410073200000,
4.15
],
[
1410678000000,
5.08
],
[
1411282800000,
3.24
],
[
1411887600000,
6.83
],
[
1412492400000,
1.67
]
]
},
{
"name": "Pr",
"stack": "rater",
"stacking": "percent",
"color": "#DDDF00",
"yAxis": 2,
"showInLegend": false,
"data": [
[
1406444400000,
null
],
[
1407049200000,
4.64
],
[
1407654000000,
1.02
],
[
1408258800000,
null
],
[
1408863600000,
0.88
],
[
1409468400000,
3.13
],
[
1410073200000,
2.3
],
[
1410678000000,
null
],
[
1411282800000,
null
],
[
1411887600000,
1.24
],
[
1412492400000,
null
]
]
},
{
"name": "Cl",
"stack": "rater",
"stacking": "percent",
"color": "#ED5618",
"yAxis": 2,
"showInLegend": false,
"data": [
[
1406444400000,
null
],
[
1407049200000,
null
],
[
1407654000000,
1.02
],
[
1408258800000,
2.22
],
[
1408863600000,
0.44
],
[
1409468400000,
0.63
],
[
1410073200000,
0.92
],
[
1410678000000,
2.03
],
[
1411282800000,
1.08
],
[
1411887600000,
null
],
[
1412492400000,
null
]
]
},
{
"name": "Other",
"stack": "rater",
"stacking": "percent",
"color": "#FF9655",
"yAxis": 2,
"showInLegend": false,
"data": [
[
1406444400000,
6.36
],
[
1407049200000,
7.28
],
[
1407654000000,
4.57
],
[
1408258800000,
6.11
],
[
1408863600000,
7.96
],
[
1409468400000,
4.38
],
[
1410073200000,
6.91
],
[
1410678000000,
8.63
],
[
1411282800000,
9.19
],
[
1411887600000,
4.97
],
[
1412492400000,
3.33
]
]
},
{
"type": "line",
"name": "QoH",
"yAxis": 3,
"data": [
[
1406444400000,
96.5
],
[
1407049200000,
96.2
],
[
1407654000000,
94.7
],
[
1408258800000,
95.9
],
[
1408863600000,
95.1
],
[
1409468400000,
95.3
],
[
1410073200000,
96.3
],
[
1410678000000,
94.4
],
[
1411282800000,
96.6
],
[
1411887600000,
96.8
],
[
1412492400000,
98.1
]
],
"_colorIndex": 3,
"_symbolIndex": 1
}
]
});
This is because left y axis has 0 at that level.
To fix it you can set
startOnTick: false,
min: 0.5
for that axis.
Example: http://jsfiddle.net/pfofo973/4/