Team System Developer Center > Visual Studio Team System Forums > Visual Studio Team System - Testing > "Parse Dependant Requests" but don't parse "Google Analytics" requests
Ask a questionAsk a question
 

Answer"Parse Dependant Requests" but don't parse "Google Analytics" requests

  • Wednesday, November 04, 2009 8:52 PMMilonguero Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    I don't want my web test to parse google analytics tracking script. 

    <script type="text/javascript"> 
            var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
            document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
        </script>
    

    Is there a way to do this with coded web tests or with other methods?


Answers

  • Friday, November 06, 2009 5:00 AMEdwer FangMSFT, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     AnswerHas Code
    Hello Milonguero,

    As I know, we could utilize the web test request level plug in to achieve the goal.

    I did some tests on my machine and everthing went well. Here are the related codes you may refer to:

    public class Class1:WebTestRequestPlugin
        {
            public override void PostRequest(object sender, PostRequestEventArgs e)
            {
                List<WebTestRequest> remove=new List<WebTestRequest>();
                foreach(WebTestRequest t in e.Request.DependentRequests)
                {
                    if(t.Url==@"http://localhost:40915/WebSite53/JScript.js")
                    {
                        remove.Add(t);
                    }
                }
                foreach(WebTestRequest m in remove)
                    e.Request.DependentRequests.Remove(m);
            }
        }
    Here is an article about how to resolve this issue you can refer to.

    More detailed information about request level plug in, you can refer to the following article:
    http://msdn.microsoft.com/en-us/library/bb514192.aspx
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Send us any feedback you have about the help from MSFT at fbmsdn@microsoft.com.

All Replies

  • Friday, November 06, 2009 5:00 AMEdwer FangMSFT, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     AnswerHas Code
    Hello Milonguero,

    As I know, we could utilize the web test request level plug in to achieve the goal.

    I did some tests on my machine and everthing went well. Here are the related codes you may refer to:

    public class Class1:WebTestRequestPlugin
        {
            public override void PostRequest(object sender, PostRequestEventArgs e)
            {
                List<WebTestRequest> remove=new List<WebTestRequest>();
                foreach(WebTestRequest t in e.Request.DependentRequests)
                {
                    if(t.Url==@"http://localhost:40915/WebSite53/JScript.js")
                    {
                        remove.Add(t);
                    }
                }
                foreach(WebTestRequest m in remove)
                    e.Request.DependentRequests.Remove(m);
            }
        }
    Here is an article about how to resolve this issue you can refer to.

    More detailed information about request level plug in, you can refer to the following article:
    http://msdn.microsoft.com/en-us/library/bb514192.aspx
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Send us any feedback you have about the help from MSFT at fbmsdn@microsoft.com.