Git Product home page Git Product logo

spfx-google-analytics's People

Contributors

joaoferreira avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

spfx-google-analytics's Issues

phantomjs-prebuilt dependency is deprecated

Attempting to build the latest code but am getting a failure when trying to load the dependency for phantomjs which appears to be deprecated and no longer being supported. Any suggestions on what to replace this with?

How can we replace Eval form the analytics?

Hi. I am using this solution. But We found out that Eval is not best practice. So we have tried below code for replacing Eval :

var gtmScript = document.createElement("script");
 gtmScript.type = "text/javascript";
 gtmScript.src = `https://www.googletagmanager.com/gtm.js?id=${trackingID}`;
 gtmScript.async = true;
 document.head.appendChild(gtmScript);

 (window as any).dataLayer = (window as any).dataLayer || [];
 (window as any).dataLayer.push(datalayerval);
 (window as any).dataLayer.push({
   'event': 'page-variables-NewDetails',
   'sharepoint-user-id': userID,
   'sharepoint-user-location': location,
   'sharepoint-user-division': division,
   'page-type': pageLayoutType,
   'article-name': articleName,
   'language': language,
   'page-published': firstPublishedDate,
   'web-title': this.context.pageContext.web.title,
   'sharepoint-user-email': Email,
   'sharepoint-user-first-name': firstName,
   'sharepoint-user-last-name': LastName,
   'sharepoint-user-mobile': mobile,
 });
 (window as any).dataLayer.push({ 'gtm.start': new Date().getTime(), event: 'gtm.js' });

It is showing output in console. But the analytics is not able to catch it and the page count goes down when we deploy this. Can anyone tell how can we get rid of Eval?

Track navigation if page is not refreshed

Some of the navigation on modern pages happens so that the browser does not load the whole page again on page load. This causes some user navigation to not get tracked with this code.

Could you update the code so that it would also track when user navigates between different pages on the modern site? Now it tracks only the first load, maybe a bit depending which navigation element is clicked.

Build Issues

@joaoferreira - I have cloned this repository and then run below commands as suggested in guideline:
git clone the repo
npm i
npm i -g gulp
gulp

I am getting below error in gulp, gulp clean, gulp build, gulp serve.

Build target: DEBUG
C:\Projects\SPFx-Google-Analytics-master\node_modules@microsoft\node-core-library\lib\JsonSchema.js:178
throw new Error(prefix + os.EOL +
^

Error: JSON validation failed:
C:\Projects\SPFx-Google-Analytics-master\config\tslint.json

Error: #/ (Defines configuration options for the...)
Additional properties not allowed: lintConfig,useDefaultConfigAsBase,removeExistingRules,displayAsWarning
at validateObjectWithCallback (C:\Projects\SPFx-Google-Analytics-master\node_modules@microsoft\node-core-library\lib\JsonSchema.js:178:19)
at JsonSchema.validateObjectWithCallback (C:\Projects\SPFx-Google-Analytics-master\node_modules@microsoft\node-core-library\lib\JsonSchema.js:193:13)
at JsonSchema.validateObject (C:\Projects\SPFx-Google-Analytics-master\node_modules@microsoft\node-core-library\lib\JsonSchema.js:175:14)
at TslintCmdTask._readConfigFile (C:\Projects\SPFx-Google-Analytics-master\node_modules@microsoft\gulp-core-build\lib\tasks\GulpTask.js:311:28)
at TslintCmdTask.onRegister (C:\Projects\SPFx-Google-Analytics-master\node_modules@microsoft\gulp-core-build\lib\tasks\GulpTask.js:87:32)
at Object.initialize (C:\Projects\SPFx-Google-Analytics-master\node_modules@microsoft\gulp-core-build\lib\index.js:299:24)
at SPWebBuildRig.initialize (C:\Projects\SPFx-Google-Analytics-master\node_modules@microsoft\sp-build-common\lib\BuildRig.js:61:19)
at SPWebBuildRig.initialize (C:\Projects\SPFx-Google-Analytics-master\node_modules@microsoft\sp-build-common\lib\SPBuildRig.js:29:15)
at SPWebBuildRig.initialize (C:\Projects\SPFx-Google-Analytics-master\node_modules@microsoft\sp-build-web\lib\SPWebBuildRig.js:15:15)
at Object.exports.initialize (C:\Projects\SPFx-Google-Analytics-master\node_modules@microsoft\sp-build-web\lib\index.js:23:17)

below are my vm configuration:

  • gulp version
    CLI version 2.1.0
    Local version 3.9.1

  • npm version
    6.8.0

  • node version
    v8.12.0

JSON error

Got json error after running gulp command

Sharepoint pageview count does not match with Google Analytics pageview count

We have implemented GA on modern hub sites on Sharepoint online and noticed difference between GA and SP's reporting tool. One page we have 67 pageviews in GA and 894 views in SP. I think SP views are reported correctly, but GA is missing a huge part of the traffic. Please let me know what is missing/any settings required to be changed in GA?

Sharepoint extension has been created and Google Analytics code has been implemented same way in this post.

Any help would be much appreciated !!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.