Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 4 of 4 total
Thread Application analytics
Tue, Oct 31 2017 4:29 PMPermanent Link

Anthony

Does anyone do any application analytics on forms used within a user's session of an EWB application?

I looked at Google Analytics but think this would only show visits to html pages on the server but still useful to get working. However I had problems getting the Google solution via EWB as it wants to be inserted in the HEAD tags, I tried the scripts but got no results in the Google real time results portal and run time errors on loading.

I also found https://www.elevatesoft.com/forums?action=view&category=ewb&id=ewb_general&page=1&msg=5647#5647 but could not get this working, think it uses an earlier version of EWB and Google Analytics.

Any assistance would be appreciated.
Wed, Nov 1 2017 5:26 AMPermanent Link

Matthew Jones

I've not done Google Analytics - I have my own logging system that can send details back to the server. But the key will be to look at the core of what is put into a page by Google, and then replicate it. For starters, update the .js file by downloading the latest one. Look at the interface that is used by the Javascript in the page, and replicate that into the EWB code. EWB Code ends up as Javascript too, so you are just aiming to repeat it.

If you get stuck on specifics, come back with questions.

--

Matthew Jones
Wed, Nov 1 2017 3:59 PMPermanent Link

Anthony

Thanks Matthew for the reply, but i'm not understanding the process.

Google asks to insert the following code in the HEAD tag of the HTML, changing the GA_TRACKING_ID to a provided unique code.

If I edit the EWB outputted HTML this all works, but recompiling the EWB application overwrites the previously manually amended HTML, how is it possible to get this to persist at design time?

<!-- Global Site Tag (gtag.js) - Google Analytics -->
<script async src="" name="https://www.googletagmanager.com/gtag/js?id=GA_TRACKING_ID">">https://www.googletagmanager.com/gtag/js?id=GA_TRACKING_ID"></script>
<script>
 window.dataLayer = window.dataLayer || [];
 function gtag(){dataLayer.push(arguments)};
 gtag('js', new Date());

 gtag('config', 'GA_TRACKING_ID');
</script>
Thu, Nov 2 2017 6:07 AMPermanent Link

Matthew Jones

Anthony wrote:

> If I edit the EWB outputted HTML this all works, but recompiling the EWB application overwrites the previously manually amended HTML, how is it possible to get this to persist at design time?

I know little of Javascript, but you can usually work it out.


<script async src="" name="https://www.googletagmanager.com/gtag/js?id=GA_TRACKING_ID">">https://www.googletagmanager.com/gtag/js?id=GA_TRACKING_ID"></script>

Okay, these things are supposed to go in the head tag. You can't do that, so this is where the script component comes in - you can reference a script externally, and EWB can add the head tag for you. Look at the project options.

<script>
 window.dataLayer = window.dataLayer || [];
 function gtag(){dataLayer.push(arguments)};
 gtag('js', new Date());

 gtag('config', 'GA_TRACKING_ID');


More script. I presume that the gtag script defines an external function called gtag, or it is being defined here, and this is embedded script to call it twice with the date and the tracking ID. So "all you have to do" is call that external function yourself.

My first step would be to look at the examples of how to reference external functions. It is generally not hard - I've done it myself and forgotten it already. But it is all there in the documentation and samples.
The second step would be to put that in a sample page, then load it into Chrome and the debugger. Put a breakpoint on that script line, and watch it go through so you see what is happening. Then you will understand what is being passed in, and what is needed.

The key is that EWB just ends up as javascript. Ain't nothing special, just you have to work out how to take the pascal version and output the Javascript needed, and it is all possible.

--

Matthew Jones
Image