When a new post or topic is submitted, I need a way to record this as an event in Google Analytics. I have tried two things so far:
- Utilizing the sph_post_create() action – the problem here is that no output is being sent to the page when this executes. I need to be able to create a script tag that executes the _gaq.push function to track the event.
- Using jQuery to tap into the click action on the newtopic and newpost submit buttons. Trouble here is that the page redirects before the _gaq.push function is finished executing.
Any thoughts here would be appreciated. Is there a way to queue up output in the sph_post_creation() action (short of writing something to the database, and then displaying it when the new post or topic is displayed)? Another thought was writing it to a cookie, but again, does not seem ideal.