Hi Darren,

Please be aware that "editing" ads in the AdWords web interface
actually deletes the old one and and create a new one, just like in
the API.  The AdParameterService method mutate() takes an array of
operations, and can set hundreds of ad parameters in a single
request.  Your current code is setting one ad parameter per request,
which is going to be much slower then setting them all in a single
request.

Best,
- Eric Koleda, AdWords API Team

On Feb 4, 4:54 am, Darren <[email protected]> wrote:
> Hi all,
>
> Thanks for your help on this.  Before the messages came up I started
> messing around and found that if I log into the AdWords UI proper, I
> was able to add '{param1:default}' to the headline of ads, and it is
> working well.
>
> The only slight issue I have with it is that I have to run something
> to first display each keyword associated with the ad, and then from
> that update the param value for each keyword.  We have around 10-20
> keywords per ad, and so it seems to take a good 20-30 seconds.  I'm
> sure this is in part because of the way I've coded it, please see my
> code below and if anyone can point out any changes I'd be very
> grateful!!
>
>         // get all keywords for the adgroup
>
>         error_reporting(E_STRICT | E_ALL);
>
>         // You can set the include path to src directory or reference
>         // AdWordsUser.php directly via require_once.
>         $path = PATHREMOVED;
>
>         //$path = dirname(__FILE__) . '/../../src';
>         //set_include_path(get_include_path() . PATH_SEPARATOR . $path);
>
>         require_once REMOVED;
>
>         try
>                 {
>                 // Get AdWordsUser from credentials in "../auth.ini"
>                 // relative to the AdWordsUser.php file's directory.
>                 $user = new AdWordsUser();
>
>                 // Log SOAP XML request and response.
>                 $user->LogDefaults();
>
>                 // Get the AdGroupCriterionService.
>                 $adGroupCriterionService = $user-
>
> >GetAdGroupCriterionService('v201008');
>
>                 $adGroupId = (float) $adgroup;
>
>                 // Create selector.
>                 $selector = new AdGroupCriterionSelector();
>
>                 // Create id filter.
>                 $idFilter = new AdGroupCriterionIdFilter();
>                 $idFilter->adGroupId = $adGroupId;
>                 $selector->idFilters = array($idFilter);
>
>                 // Get all ad group criteria.
>                 $page = $adGroupCriterionService->get($selector);
>
>                 //*** Get the AdParamService. ***
>                 $adParamService = $user->GetAdParamService('v200909');
>
>                 // Display ad group criteria.
>                 if (isset($page->entries))
>                         {
>                         foreach ($page->entries as $adGroupCriterion)
>                                 {
>                                 $type           = 
> $adGroupCriterion->criterion->CriterionType;
>
>                                 if ($type == "Keyword")
>                                         {
>                                         try
>                                                 {
>                                                 $adGroupId = (float) $adgroup;
>                                                 $keywordId = (float) 
> $adGroupCriterion->criterion->id;
>
>                                                 // Create ad parameters.
>                                                 $adParam1 = new 
> AdParam($adGroupId, $keywordId, $price, 1);
>
>                                                 // Create operations.
>                                                 $adParamOperation1 = new 
> AdParamOperation();
>                                                 $adParamOperation1->operand = 
> $adParam1;
>                                                 $adParamOperation1->operator 
> = 'SET';
>
>                                                 $operations = 
> array($adParamOperation1);
>
>                                                 // Set ad parameters.
>                                                 $adParams = 
> $adParamService->mutate($operations);
>
>                                                 // Display ad parameters.
>                                                 if (isset($adParams))
>                                                         {
>                                                         // output somethin
>                                                         }
>                                                 else
>                                                         {
>                                                         // output something
>                                                         }
>                                                 }
>
>                                         catch (Exception $e)
>                                                 {
>                                                 print $e->getMessage();
>                                                 }
>                                         }
>                                 }
>                         }
>                 else
>                         {
>                         // no ad groups found
>                         }
>                 }
>
>         catch (Exception $e)
>                 {
>                 //print $e->getMessage();
>                 }
>
> The variable $price is set beforehand.
>
> Thanks!
>
> Darren
>
> On Feb 4, 5:17 am, AdWords API Advisor <[email protected]>
> wrote:
>
>
>
>
>
>
>
> > Hi Darren,
>
> > Navneet is correct, you cannot modify the ad's headline once it is
> > created, so you cannot put the ad param in place for existing ads
> > without deleting it and losing history. So as he suggests, try
> > creating fresh ads with placeholders and change param values in the
> > future.
>
> > Cheers,
> > Anash P. Oommen,
> > AdWords API Advisor.
>
> > On Feb 4, 3:33 am, Navneet <[email protected]> wrote:
>
> > > In my understanding, you should not modify the existsing ads (if you
> > > do that, you woll loose all history anyways). Best way to achive this,
> > > create brand new ads with adaparams and then you can change the values
> > > of these params in future without affecting the history.
>
> > > Can somebody from Google API team confirm this?
>
> > > On Feb 3, 1:29 pm, P Bond <[email protected]> wrote:
>
> > > > Hi, thank you for your reply!!  Very useful information!
>
> > > > My only question is will this only work on ads created through the
> > > > API, or can I set it up with my existing ads that were set up in the
> > > > AdWords UI some time ago, and thus have lots of stats?
>
> > > > Thanks,
>
> > > > Darren
>
> > > > On Feb 3, 7:30 pm, Navneet <[email protected]> wrote:
>
> > > > > Hi Darren,
> > > > >     You can use Adparams to achieve this.
>
> > > > >http://adwordsapi.blogspot.com/2009/11/more-dynamic-ads-with-ad-param...
>
> > > > > On Feb 3, 9:09 am, Darren <[email protected]> wrote:
>
> > > > > > Hi,
>
> > > > > > I'm new to using the AdWords API, but need it to simply do the
> > > > > > following:
>
> > > > > > When we update a product price in our internal system, connect to 
> > > > > > the
> > > > > > product's ad and edit the price, which is usually displayed in the
> > > > > > 'headline' or one of the 'description' fields.
>
> > > > > > I can't see how to do this from the example code, and have seen 
> > > > > > other
> > > > > > posts on here suggesting it can't be done, and instead I'll need to
> > > > > > delete the ad and create a new one (thus losing all of the data 
> > > > > > about
> > > > > > the ad, which is not ideal).
>
> > > > > > Any ideas?
>
> > > > > > Thanks...- Hide quoted text -
>
> > > > > - Show quoted text -- Hide quoted text -
>
> > > > - Show quoted text -- Hide quoted text -
>
> > - Show quoted text -

-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and discussion group:
http://adwordsapi.blogspot.com
http://groups.google.com/group/adwords-api
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords API Forum" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en

Reply via email to