I understand that you require to extract the Google analytics data and you might be able to add 'HeaderFields' into weboptions while using MATLAB R2016a. As a workaround, consider using 'urlread2' which is a File Exchange Submission: https://www.mathworks.com/matlabcentral/fileexchange/35693-urlread2
Once downloaded, add it to your MATLAB path and then use it in the following way:
access_token = 'XXXX';
url = ['https://www.googleapis.com/analytics/v3/data/ga?', ...
'ids=ga:12345', ...
'&start-date=2018-12-01', ...
'&end-date=2019-01-31', ...
'&metrics=ga:sessions'];
headers = {'Authorization', ['Bearer ', access_token]};
response = urlread2(url, 'GET', '', headers);
data = loadjson(response);
If MATLAB R2016a would not work with 'jsondecode', consider using 'loadjson' from this MathWorks File Exchange submission:
Thanks.