I'm getting the following error when trying to implement Google Analytics reporting in a Sharepoint site page.

Uncaught SyntaxError: Unexpected identifier view-selector2.js:19 (js file and line number)

I am trying to implement Google Analytics API using the GitHub javascript files and their demo html files. I am getting this error in Chrome(v67), IE(v11) and Edge(v25). The line of code the error is reporting is

import AccountSummaries from 'javascript-api-utils/lib/account-summaries/account-summaries.js';

The program doesn't seem to know what the "import" statement is. I've seen this error reported here by others and I've tried many of their recommendations (including changing the statement to script type="module"... but nothing works. I acquired the code from GitHub so I assumed it works "as is" with minor changes to js files to accommodate my file path structure. I've struggled with this for a few weeks now so any help would be greatly appreciated. Thanks in advance. PJ

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.