Capturing Data to a text file

Sorry if this is a basic request but im looking to be able to generated a text file on click of a button or a function within a hype scene for example

I have a carousel of images with a next button that progresses through the images id like to have a text document generated locally to indicate how many times the next button was pressed allowing me to track how far people have gone through the scene

Thanks in advanced

This seems like a better fit for an analytics tool -- here's a guide for Google Analytics:

Here's a way to use PHP to get simple analytics: Button with counter (and that thread has more ideas)

unfortunately Im unable to use a third party tool like google analytics as this is for a large corporate network and our goal is to track a tools usage by exporting data to a file that can be picked up and processed through another application

thank you for your suggestion

Does your company use managed google accounts, ie email, google drive etc?

no its all internal


Some companies partner with google to use internal accounts. Was hoping yours was one and I could show you a way to push the data to a doc or even a google sheet al done within your company + googles auth shell.

So use Matomo... it in-house. supports event tracking...

its not really an option to install anything like that on the servers they are all maintained and managed by internal IT hence hoping for a more basic option such as javascript to generate a file, is this not plausible?

Just to clarify .

There are ways to download txt files from the browser being used but this is what is termed local. Ie that machines download folder.

Their own machine and browser and download folder. Not one that is shared across a network or that others can normally access.

If you want anything to be done where the file is sent across a network then you need some sort of server to run code. A companies Local networks may run a server that the page is hosted on and allow this but normally IT will just look at you as if you are from another planet if this not part of the companies normal infrastructure.

You could also post the data somewhere. maybe to a company email address, but imho it is not ideal

So what is you actual setup and what are you actually expecting.

we have a secure server that runs egain we then iframe in hype builds to assist employees with specific processes we are unable to pull information directly from hype due to security restrictions and obviously the system wont allow for browser hijacking so the work around we are trying to achieve is to generate a file that can later be pulled by our secure server but thats not what we need assistance with im simply looking to be able to hit a button in hype and generate a file on the server.

So if I understand correctly then.

You possible could have a button in hype that posts the data to the parent document( main page the iframe is on ) via postMessage.
Then the main page does the download.

to be completely honest we have the egain guys looking at that part of the process, ive only be tasked at the moment to get hype to create a file is there a preset function for this or would you happen to know a snippet of code that would achieve this?

Hype can run javascript that will create an object that can be downloaded as a file yes.

But honestly I am not sure you are asking the right question but this may be totally down to me not following your logic. :smiley:

One of the ways to download a file.

This will download an individual text file on right button clicks.
It will stop doing so after the last scene but this is not full proof in regards to how people click the buttons. i.e going back and the forwards, its just an example to show a file download (31.3 KB)

Javascript is clientside and can not create a file on a server (serverside scripting is needed) or local (<- well, it can, but only with explicit userinteraction)

Hi all, really appreciate all the help and we put this on hold while having to resolve other compatibility issues but looking to re-pick the scab so all complications aside does anyone have an example of a hype file that can record activity and use Java to write to a database?

Ultimately you will need to use a method of communication (typically XMLHTTPRequest) from Hype/client-side javascript code to send data to a process on your server, and then it is that server's responsibility to write to a database. Client-side JavaScript by itself typically doesn't have the ability to write to servers directly. There are probably better examples elsewhere on the server-side part of this!