Comments (3)
I have modified the script.js code to include the code in a window.onload function :
Looks like it solved the issue....
But I have no idea of possible side effects....
if (JSINFO.ga.gtagId) {
/* Global site tag (gtag.js) - Google Analytics */
window.onload=function(){
var script = document.createElement('script');
script.type = 'text/javascript';
script.src = 'https://www.googletagmanager.com/gtag/js?id=' + JSINFO.ga.gtagId;
//alert(document.body);
//document.body.appendChild(script);
document.body.appendChild(script);
window.dataLayer = window.dataLayer || [];
function gtag() {
dataLayer.push(arguments);
}
gtag('js', new Date());
gtag('config', JSINFO.ga.gtagId);
}
}
from dokuwiki-plugin-googleanalytics.
Hi @franckgavand , thank you. I'll take a look into this and add it in when I get some time.
from dokuwiki-plugin-googleanalytics.
By the way, I think you would only want to do that around the part adding the script tag so the rest runs without waiting for the page to load. Like, end it right after document.body.appendChild(script)
.
It was breaking JS on the page for me so I made this change by hand in the file for now and it seems to be working.
from dokuwiki-plugin-googleanalytics.
Related Issues (9)
- Config:target for interwiki and external links doesn't work unless the visitor is logging in as an admin HOT 4
- No Google Analytics data HOT 2
- Links do not work when enabled HOT 9
- The attribute value target is not respected when trackOutboundLinks is on HOT 4
- Reformat PHP / JS using off-the-shelf tools
- Prepare for 1.0.0 Release
- After updating, it still says it needs updating HOT 2
- Modification of template required? HOT 10
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dokuwiki-plugin-googleanalytics.