Skip to content

Instantly share code, notes, and snippets.

@kbshl
Last active October 30, 2017 18:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kbshl/274cb0f4090ea9281ebb to your computer and use it in GitHub Desktop.
Save kbshl/274cb0f4090ea9281ebb to your computer and use it in GitHub Desktop.
Titanium Mobile: Fire Google Analytics Screen View
// fire tracking event
require('/helpers/analytics/ga').screen(SCREENNAME);
// add postlayout event listener to fire analytics screen view
this.viewProxy.addEventListener('postlayout', function(layoutEvent) {
// remove event listener
this.removeEventListener(layoutEvent.type, arguments.callee);
// fire tracking event
require('/helpers/analytics/ga').screen(SCREENNAME);
return;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment