简体   繁体   中英

Track the user in Google Analytics but only between two actions

How can I track the user in Google Analytics but only between two actions?

I can only use Javascript including jQuery .

I would like to have the engagement time of a user during a game (not during all the page view).

My problem is actually I have the engagement time of all actions.

I would like it from the game beginning moment to the end game moment.

I really want to do that in Google Analytics.

How it it possible ?

Thanks.

There's a few approaches you could use.

If this is all on a single page, you could use custom events: https://developers.google.com/analytics/devguides/collection/gajs/eventTrackerGuide . Basically, you would need to add event handlers for "game beginning" and "game end", then log each as a custom event.

If you are trying to track them between a session, I'd try manually logging Google Analytics pages like this: https://developers.google.com/analytics/devguides/collection/analyticsjs/pages . When a user starts a game, store that somehow, either with a cookie/local storage/web call, etc, then on every page, check for that state, and if they are in the game, log the page.

This isn't exactly what GA normally does, so you'll have to do something custom like this.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM