<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>article How to implement the File Download action on Browser click path monitor with help of JavaScript Event in Troubleshooting</title>
    <link>https://community.dynatrace.com/t5/Troubleshooting/How-to-implement-the-File-Download-action-on-Browser-click-path/ta-p/209325</link>
    <description>&lt;P&gt;As we aware, Synthetic Browser Click path monitor doesn't support for File Download actions. However, with help of JavaScript Event, we can perform the same action.&lt;/P&gt;
&lt;P&gt;You can follow the below steps,&lt;/P&gt;
&lt;P&gt;1. We need to get the Fiddler session which should contain the Downloaded HTTP request and response details&lt;/P&gt;
&lt;P&gt;2. Check if the Downloaded HTTP request URL, headers and post data is static or dynamic&lt;/P&gt;
&lt;P&gt;3. If it is static then we can use the same data and will create a fetch or XMLHttpRequest JavaScript method and insert this code into the JavaScript Event of your Browser click path monitor&lt;/P&gt;
&lt;P&gt;4. If it is dynamic data then we need to get this values from the HTML source code of that page or cookies or some times we need to send the request to the server to get those values. Based on that we need to create a fetch or XMLHttpRequest JavaScript method and insert this code into the JavaScript Event of your Browser click path monitor.&lt;/P&gt;
&lt;P&gt;You can find the sample JavaScript code which we can perform the File Download action&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;api.startAsyncSyntheticEvent();
var tempToken;
var tempTokenrequesturl = "https://testing.com/services/tempToken?client=test&amp;amp;httpStatus=F&amp;amp;csfToken=csfToken&amp;amp;method=GET";
fetch(tempSessionTokenrequesturl, {
        "headers": {
            "accept": "application/xml, text/xml, */*; q=0.01",
            "accept-language": "en-US,en;q=0.9",
            "sec-ch-ua": "\"Google Chrome\";v=\"107\", \"Chromium\";v=\"107\", \"Not=A?Brand\";v=\"24\"",
            "sec-ch-ua-mobile": "?0",
            "sec-ch-ua-platform": "\"Windows\"",
            "sec-fetch-dest": "empty",
            "sec-fetch-mode": "cors",
            "sec-fetch-site": "same-origin",
            "x-requested-with": "XMLHttpRequest"
        },
        "referrer": "https://testing.com/web/",
        "method": "GET",
        "mode": "cors",
        "credentials": "include"
    }).then(response =&amp;gt; response.text())
    .then(data =&amp;gt; {
        api.info("tempToken Response " + data);
        var parser = new DOMParser();
        var xmlDOM = parser.parseFromString(data, "text/xml");
        var value = xmlDOM.getElementsByTagName("tempToken")[0].childNodes[0].nodeValue;
        tempToken = value;
        api.info(value);
        filedownloadcall();
    })
    .catch(err =&amp;gt; api.fail(err));


function filedownloadcall() {
    var filedownloadurl = "https://testing.com/filename=test?wid=123&amp;amp;sid=456&amp;amp;did=789&amp;amp;tempToken=" + tempToken ;

    fetch(filedownloadurl, {
            "headers": {
                "accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9",
                "accept-language": "en-US,en;q=0.9",
                "sec-ch-ua": "\"Google Chrome\";v=\"107\", \"Chromium\";v=\"107\", \"Not=A?Brand\";v=\"24\"",
                "sec-ch-ua-mobile": "?0",
                "sec-ch-ua-platform": "\"Windows\"",
                "sec-fetch-dest": "iframe",
                "sec-fetch-mode": "navigate",
                "sec-fetch-site": "same-origin",
                "upgrade-insecure-requests": "1"
            },
            "method": "GET",
            "mode": "cors",
            "credentials": "omit"
        }).then(response =&amp;gt; response.text())
        .then(data =&amp;gt; {
            api.info("File Download Response " + data);
            var filecontent = api.getValue("filecontent");
            if (data.indexOf(filecontent) &amp;gt;= 0) {
                api.info("File Download Success");
                api.finish();
            } else {
                api.fail("File Download Failed");
            }
        })
        .catch(err =&amp;gt; api.fail(err));

}
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;DIV id="tinyMceEditorMareeswaran_0" class="mceNonEditable lia-copypaste-placeholder"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image4.png" style="width: 999px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/11014iA57E93B38D23D199/image-size/large?v=v2&amp;amp;px=999" role="button" title="image4.png" alt="image4.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 11 Apr 2023 14:18:07 GMT</pubDate>
    <dc:creator>Mareeswaran</dc:creator>
    <dc:date>2023-04-11T14:18:07Z</dc:date>
    <item>
      <title>How to implement the File Download action on Browser click path monitor with help of JavaScript Event</title>
      <link>https://community.dynatrace.com/t5/Troubleshooting/How-to-implement-the-File-Download-action-on-Browser-click-path/ta-p/209325</link>
      <description>&lt;P&gt;As we aware, Synthetic Browser Click path monitor doesn't support for File Download actions. However, with help of JavaScript Event, we can perform the same action.&lt;/P&gt;
&lt;P&gt;You can follow the below steps,&lt;/P&gt;
&lt;P&gt;1. We need to get the Fiddler session which should contain the Downloaded HTTP request and response details&lt;/P&gt;
&lt;P&gt;2. Check if the Downloaded HTTP request URL, headers and post data is static or dynamic&lt;/P&gt;
&lt;P&gt;3. If it is static then we can use the same data and will create a fetch or XMLHttpRequest JavaScript method and insert this code into the JavaScript Event of your Browser click path monitor&lt;/P&gt;
&lt;P&gt;4. If it is dynamic data then we need to get this values from the HTML source code of that page or cookies or some times we need to send the request to the server to get those values. Based on that we need to create a fetch or XMLHttpRequest JavaScript method and insert this code into the JavaScript Event of your Browser click path monitor.&lt;/P&gt;
&lt;P&gt;You can find the sample JavaScript code which we can perform the File Download action&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;api.startAsyncSyntheticEvent();
var tempToken;
var tempTokenrequesturl = "https://testing.com/services/tempToken?client=test&amp;amp;httpStatus=F&amp;amp;csfToken=csfToken&amp;amp;method=GET";
fetch(tempSessionTokenrequesturl, {
        "headers": {
            "accept": "application/xml, text/xml, */*; q=0.01",
            "accept-language": "en-US,en;q=0.9",
            "sec-ch-ua": "\"Google Chrome\";v=\"107\", \"Chromium\";v=\"107\", \"Not=A?Brand\";v=\"24\"",
            "sec-ch-ua-mobile": "?0",
            "sec-ch-ua-platform": "\"Windows\"",
            "sec-fetch-dest": "empty",
            "sec-fetch-mode": "cors",
            "sec-fetch-site": "same-origin",
            "x-requested-with": "XMLHttpRequest"
        },
        "referrer": "https://testing.com/web/",
        "method": "GET",
        "mode": "cors",
        "credentials": "include"
    }).then(response =&amp;gt; response.text())
    .then(data =&amp;gt; {
        api.info("tempToken Response " + data);
        var parser = new DOMParser();
        var xmlDOM = parser.parseFromString(data, "text/xml");
        var value = xmlDOM.getElementsByTagName("tempToken")[0].childNodes[0].nodeValue;
        tempToken = value;
        api.info(value);
        filedownloadcall();
    })
    .catch(err =&amp;gt; api.fail(err));


function filedownloadcall() {
    var filedownloadurl = "https://testing.com/filename=test?wid=123&amp;amp;sid=456&amp;amp;did=789&amp;amp;tempToken=" + tempToken ;

    fetch(filedownloadurl, {
            "headers": {
                "accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9",
                "accept-language": "en-US,en;q=0.9",
                "sec-ch-ua": "\"Google Chrome\";v=\"107\", \"Chromium\";v=\"107\", \"Not=A?Brand\";v=\"24\"",
                "sec-ch-ua-mobile": "?0",
                "sec-ch-ua-platform": "\"Windows\"",
                "sec-fetch-dest": "iframe",
                "sec-fetch-mode": "navigate",
                "sec-fetch-site": "same-origin",
                "upgrade-insecure-requests": "1"
            },
            "method": "GET",
            "mode": "cors",
            "credentials": "omit"
        }).then(response =&amp;gt; response.text())
        .then(data =&amp;gt; {
            api.info("File Download Response " + data);
            var filecontent = api.getValue("filecontent");
            if (data.indexOf(filecontent) &amp;gt;= 0) {
                api.info("File Download Success");
                api.finish();
            } else {
                api.fail("File Download Failed");
            }
        })
        .catch(err =&amp;gt; api.fail(err));

}
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;DIV id="tinyMceEditorMareeswaran_0" class="mceNonEditable lia-copypaste-placeholder"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image4.png" style="width: 999px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/11014iA57E93B38D23D199/image-size/large?v=v2&amp;amp;px=999" role="button" title="image4.png" alt="image4.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 11 Apr 2023 14:18:07 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Troubleshooting/How-to-implement-the-File-Download-action-on-Browser-click-path/ta-p/209325</guid>
      <dc:creator>Mareeswaran</dc:creator>
      <dc:date>2023-04-11T14:18:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to implement the File Download action on Browser click path monitor with help of JavaScript Event</title>
      <link>https://community.dynatrace.com/t5/Troubleshooting/How-to-implement-the-File-Download-action-on-Browser-click-path/tac-p/212099#M188</link>
      <description>&lt;P&gt;Thank you for sharing this! I'm sure it will help out many community members.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 12 May 2023 18:58:28 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Troubleshooting/How-to-implement-the-File-Download-action-on-Browser-click-path/tac-p/212099#M188</guid>
      <dc:creator>ChadTurner</dc:creator>
      <dc:date>2023-05-12T18:58:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to implement the File Download action on Browser click path monitor with help of JavaScript Event</title>
      <link>https://community.dynatrace.com/t5/Troubleshooting/How-to-implement-the-File-Download-action-on-Browser-click-path/tac-p/299906#M1114</link>
      <description>&lt;DIV&gt;&lt;P&gt;&lt;a href="https://community.dynatrace.com/t5/user/viewprofilepage/user-id/40562"&gt;@Mareeswaran&lt;/a&gt;&amp;nbsp;I have a requirement where a file is downloaded through a Synthetic Browser Click Path monitor. The downloaded file is in &lt;STRONG&gt;ZIP format&lt;/STRONG&gt;, and inside it we need to &lt;STRONG&gt;validate specific content (search for a string)&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;I have a few concerns and would appreciate guidance:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;ZIP File Validation&lt;/STRONG&gt;&lt;BR /&gt;Since the file is compressed, is it possible to:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Read or extract the ZIP file content within a Synthetic script (JavaScript event)?&lt;/LI&gt;&lt;LI&gt;Validate a string inside the extracted file?&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;Private Location Execution &amp;amp; Storage Impact&lt;/STRONG&gt;&lt;BR /&gt;This monitor will be executed every &lt;STRONG&gt;5 minutes from a Private Location&lt;/STRONG&gt;, which means:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;The ZIP file will be downloaded repeatedly&lt;/LI&gt;&lt;LI&gt;This may lead to &lt;STRONG&gt;storage flooding over time&lt;/STRONG&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;So, I would like to understand:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Does Synthetic store these downloaded files on the Private Location machine?&lt;/LI&gt;&lt;LI&gt;If yes, how can we manage or clean up these files automatically?&lt;/LI&gt;&lt;LI&gt;Is there a recommended best practice to avoid storage issues?&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;/DIV&gt;</description>
      <pubDate>Mon, 25 May 2026 11:51:30 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Troubleshooting/How-to-implement-the-File-Download-action-on-Browser-click-path/tac-p/299906#M1114</guid>
      <dc:creator>shivam_mishra</dc:creator>
      <dc:date>2026-05-25T11:51:30Z</dc:date>
    </item>
  </channel>
</rss>

