Targeting orders using MetroArea Target

Hello, All.

I'm including my SOAP call below. I'm trying AddOrder using a MetroAreaTarget.

The call does produce an order, but, it's unclear to me that the order is targeted at my metro area. Do you know how I can tell that the order is being targeted, and not launched for all users

When I look into the UI to see my order, it looks like an order that is not targeted. When I create an order with targeting from the UI, it shows a little bit differently. This leads me to think the one I create through the API is not targeted.

If you have any clues for me, I'd appreciate it.

Thanks.
SOW

< xml version="1.0" encoding="utf-8" >
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Header>
<ApiUserAuthHeader xmlns="http://adcenter.msn.com/syncapis">
<UserName>xxxxxxxxxxxxxx</UserName>
<Password>xxxxxxxxxxxxxxx</Password>
<UserAccessKey>xxxxxxxxxxxxxx</UserAccessKey>
</ApiUserAuthHeader>
</soap:Header>
<soap:Body>
<AddOrders xmlns="http://adcenter.msn.com/syncapis">
<Orders><AdCenterOrder><Status>Submitted</Status><OrderTarget>
<locationTarget>
<MetroAreaTarget>
<targetDetailsForMetroAreas>
<includeOtherMetroAreaTargets>false</includeOtherMetroAreaTargets>
<TargetDetailsForAMetroArea>
<targettedMetroAreaId>864475633084792832</targettedMetroAreaId>
<incrementalBidPercentage>ZeroPercent</incrementalBidPercentage>
</TargetDetailsForAMetroArea>
</targetDetailsForMetroAreas>
</MetroAreaTarget>
</locationTarget></OrderTarget><KwdLanguage>English</KwdLanguage><OrderName>karate master2006-09-22-51421-6388335</OrderName><OrderStartDate>2006-09-22</OrderStartDate><OrderEndDate>2016-09-19</OrderEndDate><MSNDistributionSite>UnitedStates</MSNDistributionSite></AdCenterOrder></Orders><CampaignId>242178</CampaignId>
</AddOrders>
</soap:Body>
</soap:Envelope>



Answer this question

Targeting orders using MetroArea Target

  • Gurpreet Singh Gill

    Hello.

    The following C# code shows how to implement incremental bidding targeting Laramie, WY.

    using System;
    using System.Collections.Generic;
    using System.Text;
    using TargetLaramie.com.msn.idss.api.beta6;

    namespace TargetLaramie
    {
        class Program
        {
            static void Main(string[] args)
            {

                CampaignManagement objCampaignManagement;
                objCampaignManagement = new CampaignManagement();

                // Authentication information.
                ApiUserAuthHeader apiUserAuthHdr;
                apiUserAuthHdr = new ApiUserAuthHeader();
                apiUserAuthHdr.UserName = "your_user_name";
                apiUserAuthHdr.Password = "your_user_password";
                apiUserAuthHdr.UserAccessKey = "your_user_accesskey";

                objCampaignManagement.ApiUserAuthHeaderValue = apiUserAuthHdr;


                // Target variables.
                MetroAreaTarget metroTarget;
                Target target;

                EntityResultType ert;
                int i;


                // Initialize the location target details array.
                TargetDetailsForAMetroArea[] arrayMetro = new TargetDetailsForAMetroArea[1];
                arrayMetro[0] = new TargetDetailsForAMetroArea();
                // See the "Retrieving the Metro Area IDs for a Country" topic
                // to determine how the metro ID is retrieved
                arrayMetro[0].targettedMetroAreaId = 864475633084792832; // Laramie, WY
                arrayMetro[0].incrementalBidPercentage = IncrementalBidPercentage.OneHundredPercent;
                metroTarget = new MetroAreaTarget();
                metroTarget.targetDetailsForMetroAreas = arrayMetro;
                metroTarget.includeOtherMetroAreaTargets = false;
                
                //  Assign the metro target to a location target variable.
               
    LocationTarget locationTarget = new LocationTarget();
                locationTarget.metroAreaTarget = metroTarget;

                // Use the new target information.
                target = new Target();
                target.locationTarget = locationTarget;


                // orders is an array of AdCenterOrders.
                // orders can be created for an original order addition
                // via AddOrders(), or used to modify existing orders via
                // UpdateOrders().
                // This example will modify existing orders.
                // Instead of calling GetOrders, you could retrieve the
                // order information from your own database, thereby
                // preventing your quota balance from being decremented.
                // Campaign 12885 is specific to this example.
                AdCenterOrder[] orders = objCampaignManagement.GetOrders(0, 12885);

                foreach (AdCenterOrder order in orders)
                {
                    // Apply the new target information
                    order.orderTarget = target;
                }

                // 12885 is specific to this example.
                ert = objCampaignManagement.UpdateOrders(0, 12885, orders);

                // Check the returned rows for success or failure.
                // Failed rows.
                for (i = 0; i < ert.FailedRow.Length; i++)
                {
                    Console.WriteLine("Failed Order - ID: {0} Reason: {1}",
                        orders[ert.FailedRow[ i ].Index].OrderId,
                        ert.FailedRow[ i ].ErrorCode);
                }
                // Success rows.
                for (i = 0; i < ert.SuccessRow.Length; i++)
                {
                    Console.WriteLine("Successful Order - ID: {0}",
                        ert.SuccessRow[ i ].Id);
                }

            }
        }
    }

    Upon successfully running the code, you can check the adCenter user interface to confirm that the order targets the Laramie, WY. metro area.

    Thank you,

    Walter Poupore  - MSFT

     



  • Sorin Sandu

    That's a good point. Most of us here feel "at home" with C# and sometimes VB, less so with other languages.

    Thanks for pointing this out.


  • cb3431

    Walter,

    Thanks for your response. I was able to get a friend to use C# to submit these requests and then used a network protocol analyzer to read the SOAP and figure out our problem, and, now, we've got everything working.

    However, I am curious why you (plural, referring to the API help resources, including the forum, msnacapi@microsoft.com, and the .chm file) always use C# in your examples. Although I understand why you're using C#, I don't use C#, and our company doesn't use it, either. While I'm told that C# is excellent for SOAP because of its WSDL tools, it seems like it might be more thorough for MSN to support everything from a SOAP level, allowing them to answer any question a user has communicating with the API. That way, language implementation and understanding is never part of the troubleshooting problem.

    I ask this question because it would be easier for me to communicate with you (again, plural), but I do wonder if it would also make it easier for you to communicate with me. If I tell you my SOAP, and you say "hey, your SOAP is missing this or that", I'm responsible for making my language implementation (Python) speak the correct SOAP.

    Thanks,
    Sherrett

  • Targeting orders using MetroArea Target