3 Sep 2012 9:36 PM #1
onClick tracking event for internal slides?
I'm trying to integrate an onClick event that fires a tracking code just like a Google event tracker, I want to implement that for the buttons that use the function "Go To Scene" or any other function.
So basically the onClick event format is:
I'm pretty sure that I can do that by implementing a custom JS for the button to go to the other scene and then fire off the onClick event. Problem is that I haven't worked with Sencha for a year now and getting rusty with the syntax. Thanks
4 Sep 2012 1:16 AM #2
With the latest 1.3 release, we also improved the documentation of JS functions that are available when editing custom JS. You can find it here: http://docs.sencha.com/animator/1-3/...de/advanced_js
To achieve what you are trying to do, you indeed need to set the click event to custom JS and then enter following:
//your tracking code Snakk.log('Address','Title','click'); //go to next scene code controller.goToNextScene();
controller.startSceneById(scene_id); //or controller.startSceneByName(scene_name);
Finally, don't forget to include the definition of your tracking code function in the project header.
Hope it helps, and good luck with your project.
4 Sep 2012 3:51 PM #3
Actually that doesn't work, there is no way i can think off that can initiate an onClick event in sencha animate! Arne?
5 Sep 2012 7:44 AM #4
That should work
Basically, you can set the click action in Animator for the object to custom JS and then you can call all the functions you want, like Miro described.
If you are still having issues with it, could you describe what is not working?
5 Sep 2012 2:27 PM #5
When placing the click action before the controller.goToNextScene...etc the button refuses to execute.
I've tried the following
None of the above works. I've looked at the event tracking documentation for google analytics, the only way I could find was through an onClick function. There is another method that is suitable for Flash ActionScript only!
5 Sep 2012 2:42 PM #6
Sounds like your call to the tracking results in an error, hence the go to next scene is never reached.
From the page you linked, here is an example of how to call google analytics from the code.
_gaq.push(['_trackEvent', 'Videos', 'Play', 'Baby\'s First Birthday']); //and then you could call the controller controller.goToNextScene();