Track the user in Google Analytics but only between two actions - javascript

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.

Related

Google Analytics Event Unique Per Session

I have a site where I track click outs, one user may click out several times so if I have 100 users I may have 300 click out events. This is ok for a rough guide but ideally I would like to know how many users have clicked out so 100 users 85 users clicked out.
I could write some js on my site to handle this store in a cookie but I was wondering if there is anything in ga.js that will allow me to fire an event once per session.
You can use Custom Dimensions to scope things to the session (or even the user). Create a dimension in the Google Analytics admin tab under Property within Custom Definitions.
Set the scope to session, then copy the ga('set', 'dimension1', 'Description Here'); and paste it before sending the event (obviously, change "Description Here" to your own explanation. Also, make sure 'dimension1' matches the index it gives you.
Custom dimensions (and metrics) are tied to hit types, so simply setting them does nothing until a hit type is sent- so either a pageview or an event.
Once you've created the dimension, you can use it for anything you would a standard dimension in reporting- including segments and custom reports.
Hope that helps!

How can we retrieve the upcoming facebook events that are located in a specific country(location)?

I want to access the events listed all over FB in a specific location? By these events I mean the open events.
I have asked several times in many channels before, but it seems that this is not possible. There is the Search API, but you can only search for even names: https://developers.facebook.com/docs/reference/api/search/
Although, if there is a Facebook Page for the location, you can indeed grab the events:
https://developers.facebook.com/docs/graph-api/reference/page/events/
/[page-id]/events
This works even without any Access Token (if the page is not hidden, of course).

Can I track changes to a web form using webtrends?

Does anyone know of a way to track changes to a web form, i.e. select or text field using webtrends?
I know Google Analytics has similar functionality, can this be done in WebTrends?
Webtrends has Javascript click tracking so you'd have to add Javascript onChange or onClick events to whatever you need to track.
Since web forms don't typically trigger the Webtrends link tracking, you have to use the dcsMultiTrack function, passing the variables that need to be tracked.
For example, you might use the following to track the URL that you're on and the fact that a particular field was clicked:
onClick="onclick="dcsMultiTrack('DCS.dcssip','www.domain.com','DCS.dcsuri','/yourpage', 'WT.ti','formfield1','WT.dl','1');"
Note that the WT.dl parameter should be set so you don't count extra page views. Also note that the WT.ti parameter is used for automatically tracking this as a link click. If you need more granularity, you can always define another variable (for example, "formname) and configure Webtrends to report on that as another dimension.

Google analytics track event causing page to change

I have a flash file and am using google's suggested method for as2 event tracking like so:
getURL("javascript:pageTracker._trackEvent('Refferal', 'Join', 'Benefits for HCAs/APs');");
The problem is that instead of silently communicating, pageTracker._trackEvent() appears to return a boolean value. Every time I click the button which this is located on I leave the page I was on and end up on a page that just contains the word "true".
Does anyone know how to get around this? It makes the flash unusable.
If your flash is embedded in a web page, you could call a javascript function and let it handle the call to analytics using an external interface:
ExternalInterface.call("myJavaScriptFunction", parameter1, parameter2); (http://geekswithblogs.net/Mikeymac/archive/2006/03/13/72170.aspx)

Outbound link tracking - Google Analytics' _trackEvent() and Omniture's s.tl()

We have a site that uses both Omniture and Google Analytics. Ideally, we want to report in both suites on clicks to outbound links.
I'd like to do this the "right way," i.e. overcoming the race condition that occurs when requesting a site and the tracking pixel at the same time. See: http://www.gwotricks.com/test/2009/07/tracking-outbound-links-right-way.html
I probably wouldn't use the "onclick" attribute, instead binding the trackEvent to the link's click event.
Omniture's external link tracking overcomes the condition by hooking a 500ms delay into s.tl():
www. webmetric.org/white_paper/link_tracking.pdf
Has anyone tried doing both on the same site? Ideally I'd like to call both tracking pixels with an appropriate amount of time before the page executes, but I'm not a big enough Omniture buff to really have gone in-depth with their code and hook trackEvent in before the delay.
Use JavaScript DOM (or if you use it, jQuery) to bind the events and utilize the new asynchronous Google Analytics tracking code and you should be set.
Sample codes for JavaScript event binders are everywhere if you don't want to use jQuery.
Done this several times, never interfered and never had to use a timer.

Categories

Resources