WebClient Impression not Registering (DAAST / VAST)

cooper1210

New member
Joined
Dec 4, 2016
Messages
1
Programming Experience
1-3
So I am having an issue with some DAAST (or VAST they are similar) software. It's a program that injects audio adverts into a live audio stream. The problem is not the ad injection, but the impressions are not being registered with the ad agency.

This is the code I have:

if(ad.AdData.Doc!=null)
            {

                XmlDocument doc =newXmlDocument();

                doc.LoadXml(ad.AdData.Doc.ToString());

                try
                {

                    XmlNodeList mp3 = doc.GetElementsByTagName("MediaFile");
                    String urlMp3 = mp3[0].InnerText.Replace("![CDATA[","").Replace("]]","".Replace("<","").Replace(">",""));

                    XmlNodeList events = doc.GetElementsByTagName("Tracking");

                    XmlNodeList impression = doc.GetElementsByTagName("Impression");
                    String urlImpression = impression[0].InnerText.Replace("![CDATA[","").Replace("]]","".Replace("<","").Replace(">",""));

                    string urlStart ="";
                    string urlComplete ="";

                    for(int i =0; i <3; i++)
                    {
                        switch(events[i].Attributes[0].InnerText)
                        {
                            case"start":
                                urlStart = events[i].InnerXml.Replace("![CDATA[","").Replace("]]","").Replace("<","").Replace(">","");
                                break;
                            case"complete":
                                urlComplete = events[i].InnerXml.Replace("![CDATA[","").Replace("]]","").Replace("<","").Replace(">","");
                                break;
                        }
                    }

                    WebClient clientM =newWebClient();

                    // Download MP3
                    //LogMessage("Downloading MP3: IP- " + data.IP.ToString() + " Country- " + data.country);

                    try
                    {
                        clientM.DownloadDataAsync(newUri(urlMp3));
                    }
                    catch(Exception e)
                    {
                    }

                    WebClient clientI =newWebClient();
                    WebClient clientS =newWebClient();
                    WebClient clientC =newWebClient();

                    // Test whether client is still 'connected'
                    if((DateTime.Now- startConn).TotalSeconds<(int)listener.Duration)
                    {
                        // Fire start / impression NOW. Wait 30 / fire complete

                        LogMessage("Firing Impressions: IP- "+ data.IP.ToString()+" Country- "+ data.country);
                        // LogMessage(ad.AdData.Doc.ToString());
                        // LogMessage("Start URL: - " + urlStart);
                        // LogMessage("Impression URL : - " + urlImpression);
                        clientS.DownloadStringAsync(newUri(urlStart));
                        clientI.DownloadStringAsync(newUri(urlImpression));


                        clientI.DownloadStringCompleted+=(s, err)=>
                        {
                            if(err.Error!=null)
                                LogMessage("Error sending event");
                        };

                        Thread.Sleep(30000);


                        //LogMessage("Firing Complete: IP- " + data.IP.ToString() + " Country- " + data.country);
                        clientC.DownloadStringAsync(newUri(urlComplete));
                }
                catch(Exception e)
                {


                }
            }
        }
This is an example DAAST XML request, I have replaced the URLs with something else to protect the identity of the agency:
HTML:
<?xml version='1.0' encoding='utf-8'?>
<DAAST xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.0">
  <Ad id="1:0">
    <Wrapper>
      <AdSystem version="2.0">SomeAdAgency</AdSystem>
      <AdTitle>SomeAdAgency</AdTitle>
      <VASTAdTagURI><![CDATA[https://www.SomeAdAgency.com/web/999.xml?daast=1&ip=95.108.142.138&user_id=250841716ef6cad8a537f3a082efed2b]=]=></VASTAdTagURI>
      <Impression><![CDATA[http://www.SomeAdAgency.com/stat/impression.gif?v=bj0xJnM9MTAwMSZrPTI1MDg0MTcxNmVmNmNhZDhhNTM3ZjNhMDgyZWZlZDJi&r=385530794]=]=></Impression>
      <Error><![CDATA[http://www.SomeAdAgencycom/stat/error.gif?v=bj0xJnM9MTAwMSZrPTI1MDg0MTcxNmVmNmNhZDhhNTM3ZjNhMDgyZWZlZDJi&r=538342366]=]=></Error>
      <Creatives>
        <Creative>
          <Linear>
            <TrackingEvents>
              <Trackingevent="creativeView"><![CDATA[http://www.SomeAdAgency.com/stat/creativeView.gif?v=bj0xJng9MWYyOUY5RTFDQUFERjhkZCZzPTEwMDEmaz0yNTA4NDE3MTZlZjZjYWQ4YTUzN2YzYTA4MmVmZWQyYg%3D%3D&r=747800021]=]=></Tracking>
              <Trackingevent="start"><![CDATA[http://www.SomeAdAgency.com/stat/start.gif?v=bj0xJng9NUZFM0I2M2YyZDhjYzk4NCZzPTEwMDEmaz0yNTA4NDE3MTZlZjZjYWQ4YTUzN2YzYTA4MmVmZWQyYg%3D%3D&r=765191338]=]=></Tracking>
              <Trackingevent="complete"><![CDATA[http://www.SomeAdAgency.com/stat/complete.gif?v=bj0xJnM9MTAwMSZrPTI1MDg0MTcxNmVmNmNhZDhhNTM3ZjNhMDgyZWZlZDJi&r=655109920]=]=></Tracking>
              <Trackingevent="pause"><![CDATA[http://www.SomeAdAgency.com/stat/pause.gif?v=bj0xJnM9MTAwMSZrPTI1MDg0MTcxNmVmNmNhZDhhNTM3ZjNhMDgyZWZlZDJi&r=109389167]=]=></Tracking>
              <Trackingevent="resume"><![CDATA[http://www.SomeAdAgency.com/stat/resume.gif?v=bj0xJnM9MTAwMSZrPTI1MDg0MTcxNmVmNmNhZDhhNTM3ZjNhMDgyZWZlZDJi&r=191427080]=]=></Tracking>
              <Trackingevent="rewind"><![CDATA[http://www.SomeAdAgency.com/stat/rewind.gif?v=bj0xJnM9MTAwMSZrPTI1MDg0MTcxNmVmNmNhZDhhNTM3ZjNhMDgyZWZlZDJi&r=260515587]=]=></Tracking>
              <Trackingevent="firstQuartile"><![CDATA[http://www.SomeAdAgency.com/stat/firstQuartile.gif?v=bj0xJnM9MTAwMSZrPTI1MDg0MTcxNmVmNmNhZDhhNTM3ZjNhMDgyZWZlZDJi&r=254469603]=]=></Tracking>
              <Trackingevent="midpoint"><![CDATA[http://www.SomeAdAgency.com/stat/midpoint.gif?v=bj0xJnM9MTAwMSZrPTI1MDg0MTcxNmVmNmNhZDhhNTM3ZjNhMDgyZWZlZDJi&r=241892418]=]=></Tracking>
              <Trackingevent="thirdQuartile"><![CDATA[http://www.SomeAdAgency.com/stat/thirdQuartile.gif?v=bj0xJnM9MTAwMSZrPTI1MDg0MTcxNmVmNmNhZDhhNTM3ZjNhMDgyZWZlZDJi&r=956375908]=]=></Tracking>
            </TrackingEvents>
            <AudioInteractions>
              <ClickTracking><![CDATA[http://www.SomeAdAgency.com/stat/click.gif?v=bj0xJng9NUMwMGJlZEYzRDNCRWEzMCZzPTEwMDEmaz0yNTA4NDE3MTZlZjZjYWQ4YTUzN2YzYTA4MmVmZWQyYg%3D%3D&r=134882117]=]=></ClickTracking>
            </AudioInteractions>
          </Linear>
        </Creative>
      </Creatives>
      <Extensions>
        <Extension type="isClickable"><![CDATA[0]=]=></Extension>
      </Extensions>
    </Wrapper>
  </Ad>
</DAAST>

I suspect it's an issue with the way I'm downloading or calling the tracking pixel?

Can anyone share any light on this please?

Thank you
 
Last edited by a moderator:
Back
Top Bottom