保存Google Script for Google Analytics时如何解决“非法字符"错误 [英] How to solve “illegal character” error when saving Google Script for Google Analytics

查看:77
本文介绍了保存Google Script for Google Analytics时如何解决“非法字符"错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在自动进行Google Analytics(分析),以将结果输入到Google Drive仪表板中,并给出非法字符(第7行,文件代码")的错误代码".我该如何解决此问题?这是完整的脚本.我先感谢您的帮助.谢谢.

I'm working on automating Google analytics to get results into a google drive dashboard and coming up with an error code in "illegal character. (line 7, file "code")" How do i fix this problem? Here is the full script. I appreciate the help in advance. Thanks.

// Get Data.
var results = Analytics.Data.Ga.get(
    tableId,
    startDate,
    endDate,
    'ga:visitors,ga:visits,ga:pageviews',
    {‘dimensions’: ‘ga:date’});

// Output to spreadsheet.
var sheet = SpreadsheetApp.getActiveSpreadsheet().insertSheet();
sheet.getRange(2, 1, results.getRows().length, headerNames.length)
    .setValues(results.getRows());

// Make Sandwich.

推荐答案

不确定错误消息中的第7行是否与您粘贴的代码中的第7行相同,但是如果是,则看起来单引号是不同的.使用单引号('),而不要使用弯曲的单引号.

Not sure if line 7 in the error message is the same line 7 in the code you pasted, but if it is, then it looks like the single quotes are different. Use the straight single quote ('), and not the curvy one.

这是我的意思:

{‘dimensions’: ‘ga:date’});

应该是

{'dimensions': 'ga:date'});

希望这会有所帮助.

这篇关于保存Google Script for Google Analytics时如何解决“非法字符"错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆