Comments (9)
Ah, I see!
You can use ga-lite exactly the same way in this case as you would in the official Google Analytics: Just replace the ga
with galite
:
galite('create', 'UA-xxx-1', 'auto');
galite('send', 'pageview');
setTimeout(function() {
galite("send", "event", "New Visitor", location.pathname)
}, 15000);
from ga-lite.
If you see your session at Google analytics realtime, you can be 100% sure your code works and the events are firing fine. Good job! 👌
from ga-lite.
Hey, can you describe in more detail what you're trying to achieve?
Session timeout (= after what time of inactivity the user's session is ended and next events count as a new session) is commonly set in the Google Analytics' admin panel
Here's a screenshot of the admin panel from my personal blog's analytics, where I have set the session timeout to 30 minutes:
from ga-lite.
Sorry, I've described it without proper details:
I mean the minimum time which user should remain on website in order to count it as session.
In my GA settings it's 15seconds:
ga('send', 'pageview');
setTimeout(function() {
ga("send", "event", "New Visitor", location.pathname)
}, **15000**);
from ga-lite.
Understood, thank you!
Just one problem left.
I'm using react and I've placed this code in index.js:
...
import galite from 'ga-lite';
class App extends React.Component {
componentWillMount() {
galite('create', 'UA-xxx-1', 'auto');
galite('send', 'pageview');
setTimeout(function() {
galite("send", "event", "New Visitor", location.pathname)
},
}
...
And google tag assistant throws me this error:
No HTTP response detected
Have I done something wrong?
from ga-lite.
Google Tag Assistant probably does not detect ga-lite, since ga-lite is not officially supported by Google (although the API endpoint ga-lite uses is).
You should see requests to www.google-analytics.com happening in your browser's developer tools' "Network" tab for each event/pageview that you send:
from ga-lite.
My Js files are heavily compressed, that's what I see locally:
Is it ok?
While on live version I don't see something related to GA
P.S. also at analytics.google.com I see that there is a session in real time
from ga-lite.
P.S. press "all" in your network tab and you'll see the Google analytics calls there too. Now it shows only the js files.
from ga-lite.
Thank you very much!
from ga-lite.
Related Issues (20)
- Support for the new Google Analytics 4 tag HOT 9
- Use keepalive flag with fetch
- Capture ga() function calls and re-route them through galite() HOT 5
- Add note to README about using preconnect/preload to improve google page speed HOT 7
- ESM version for modern browsers HOT 10
- Universal Analytics (GA3) and GA4 same time HOT 2
- Illegal Invocation error due to lack of navigator.sendBeacon binding HOT 1
- Self Referral Traffic
- NPM bundle not including commands directory HOT 1
- Customizable endpoint URL and User Language HOT 2
- Instructions on using esm version to readme HOT 4
- SyntaxError Unexpected token = HOT 2
- Yarn run build not working HOT 4
- XMLHttpRequest on main thread is deprecated HOT 2
- Are Conversion Tags Possible & Phone Number Tags HOT 4
- Disableing of ga-lite through cookie HOT 4
- SSR issue introduced HOT 5
- It should be mentioned that ga-lite doesn't use cookies HOT 3
- Stop working on Chrome 85+ for somehow HOT 6
- Test coverage for SSR / node.js compatibility HOT 1
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 ga-lite.