Giter Site home page Giter Site logo

Hot to set session timeout? about ga-lite HOT 9 CLOSED

01Kuzma avatar 01Kuzma commented on September 22, 2024
Hot to set session timeout?

from ga-lite.

Comments (9)

jehna avatar jehna commented on September 22, 2024 1

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.

jehna avatar jehna commented on September 22, 2024 1

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.

jehna avatar jehna commented on September 22, 2024

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:

screen shot 2018-01-19 at 14 51 58

from ga-lite.

01Kuzma avatar 01Kuzma commented on September 22, 2024

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.

01Kuzma avatar 01Kuzma commented on September 22, 2024

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.

jehna avatar jehna commented on September 22, 2024

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:

screen shot 2018-01-19 at 15 52 17

from ga-lite.

01Kuzma avatar 01Kuzma commented on September 22, 2024

My Js files are heavily compressed, that's what I see locally:
image
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.

jehna avatar jehna commented on September 22, 2024

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.

01Kuzma avatar 01Kuzma commented on September 22, 2024

Thank you very much!

from ga-lite.

Related Issues (20)

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.