• Forums
    • Public Forums
      • Community Connect
      • Dynatrace
        • Dynatrace Open Q&A
      • Application Monitoring & UEM
        • AppMon & UEM Open Q&A
      • Network Application Monitoring
        • NAM Open Q&A
  • Home /
  • Public Forums /
  • Application Monitoring & UEM /
  • AppMon & UEM Open Q&A /
avatar image
Question by Gil G. · Jan 15, 2015 at 07:57 PM ·

JS ADK challenge

Hi, 

We need to measure on a web application the complete time it takes since a user selects a value from a select box on a web page, which then triggers a page load, until the end of the page load. Looking at the samples of the JS, I thought the correct way should be as follows:

  1. hook into the onchange event of the first page and enterAction
  2. hook into the onLoad event of the second page and leaveAction. 
  3. To make sure it was the same action the action value is passed in cookie.

Here is a short example of what we've tried doing:

 

This is the code for the first page (page1.html):

<html>
<head>
<title>dynaTrace JavaScript ADK</title>
<script type="text/javascript" src="../dtagentApi.js"></script>
<script type="text/javascript">
function performAction(){
                
dynaTrace.setAutomaticActionDetection(false);
var mySelect=document.getElementById('MySelect');
var sel=mySelect.selectedIndex;
var value=mySelect.options[sel].value;

var actionName = dynaTrace.enterAction(value,'click');
top.location.href='page2.html';
document.cookie = document.cookie + "customDynatraceAction=" + actionName + ";";
}
</script>
</head>
<body>
When Clicked it will go to page2
<div>
<select name="MySelect" id="MySelect" onchange="javascript:performAction()">
<option value="Gil">Gil</option>
<option value="Hagit">Hagit</option>
</select>
 

<br/>
<br/>
<a href="../index.html">Back</a>
</body>
</html>

 

And this is for page2:

<html>
<head>
<title>dynaTrace JavaScript ADK</title>
<script type="text/javascript" src="../dtagentApi.js"></script>

<script type="text/javascript">

function leaveAction(){
dynaTrace.setAutomaticActionDetection(false);
dynatrace.reportEvent("Started page 2");
dynatraceCustomAction = "";
match = document.cookie.match(new RegExp(name + '=([^;]+)'));
if (match) dynatraceCustomAction = match[1];
if (dynatraceCustomAction.length > 0 ) {
dynaTrace.leaveAction(dynatraceCustomAction);
}
else
{
dynatrace.reportEvent("No Cookie Value Found");
}
dynaTrace.setAutomaticActionDetection(true);
}
</script>
<link rel="stylesheet" href="//jqueryui.com/jquery-wp-content/themes/jquery/css/base.css?v=1">
<link rel="stylesheet" href="//jqueryui.com/jquery-wp-content/themes/jqueryui.com/style.css">

<script src="//jqueryui.com/jquery-wp-content/themes/jquery/js/modernizr.custom.2.8.3.min.js"></script>

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="//jqueryui.com/jquery-wp-content/themes/jquery/js/jquery-1.11.2.min.js"><\/script>')</script>

<script src="//jqueryui.com/jquery-wp-content/themes/jquery/js/plugins.js"></script>
<script src="//jqueryui.com/jquery-wp-content/themes/jquery/js/main.js"></script>

<script src="//use.typekit.net/wde1aof.js"></script>
</head>

<body onload="javascript:leaveAction">
PAGE 2
<div>
<a href="page1.html">Go Back</a>
</div>
<br/>
<br/>
</body>
</html>

 

Unfortunately, this is not workng in the way that 

  1. I don't see the event being reported.
  2. the click event on the value is very short and does not reflect the load time of page2.

 

Can anyone help ?

 

Thanks, 

 

Gil.

Comment

People who like this

0 Show 0
10 |2000000 characters needed characters left characters exceeded
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Toggle Comment visibility. Current Visibility: Viewable by all users

Up to 10 attachments (including images) can be used with a maximum of 50.0 MiB each and 250.0 MiB total.

1 Reply

  • Sort: 
  • Most voted
  • Newest
  • Oldest
avatar image

Answer by Clemens F. · Jan 19, 2015 at 08:07 PM

Hi Gil,

isn't JS agent detecting the click and page load automatically in your case?
When I take your pages and remove almost all JS code except the part where page2.html is loaded, I get a perfect click on ... action with a linked page load.

-Clemens 

Comment

People who like this

0 Show 1 · Share
10 |2000000 characters needed characters left characters exceeded
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Toggle Comment visibility. Current Visibility: Viewable by all users

Up to 10 attachments (including images) can be used with a maximum of 50.0 MiB each and 250.0 MiB total.

avatar image Gil G. · Jan 19, 2015 at 08:13 PM 0
Share

Hi Clemens, 

Since it included some more steps inside, it broke up. Using the ADK with "enableAutomaticDetection" to false, entering the action and then leaving it on the second page solved the problem.

 

Thanks.

 

Gil.

How to get started

First steps in the forum
Read Community User Guide
Best practices of using forum

NAM 2019 SP5 is available


Check the RHEL support added in the latest NAM service pack.

Learn more

LIVE WEBINAR

"Performance Clinic - Monitoring as a Self Service with Dynatrace"


JANUARY 15, 3:00 PM GMT / 10:00 AM ET

Register here

Follow this Question

Answers Answers and Comments

2 People are following this question.

avatar image avatar image

Forum Tags

dotnet mobile monitoring load iis 6.5 kubernetes mainframe rest api dashboard framework 7.0 appmon 7 health monitoring adk log monitoring services auto-detection uem webserver test automation license web performance monitoring ios nam probe collector migration mq web services knowledge sharing reports window java hybris javascript appmon sensors good to know extensions search 6.3+ server documentation easytravel web dashboard kibana system profile purelytics docker splunk 6.1 process groups account 7.2 rest dynatrace saas spa guardian appmon administration production user actions postgresql upgrade oneagent measures security Dynatrace Managed transactionflow technologies diagnostics user session monitoring unique users continuous delivery sharing configuration alerting NGINX splitting business transaction client 6.3 installation database scheduler apache mobileapp RUM php dashlet azure purepath agent 7.1 appmonsaas messagebroker nodejs 6.2 android sensor performance warehouse
  • Forums
  • Public Forums
    • Community Connect
    • Dynatrace
      • Dynatrace Open Q&A
    • Application Monitoring & UEM
      • AppMon & UEM Open Q&A
    • Network Application Monitoring
      • NAM Open Q&A