Script for dynamic insertion of live prices in ads

76 views
Skip to first unread message

Kristian

unread,
Apr 21, 2016, 9:17:51 AM4/21/16
to AdWords API Forum

Hello,


A friend of mine has helped me set up an API-solution.


The purpose of the tool is to update ads in four adgroups with live prices pulled from an XML-extract every 15 min. 


The script works as fine, however, I have one question. 

          

In every adgroup I need a criterionId for a keyword:   



                            <v20:operations>

                            <v20:operator>SET</v20:operator>

                       <!-- Adgroup name (som low)-->

                       <v20:operand>

                          <v20:adGroupId>20475900299</v20:adGroupId>

                          <v20:criterionId>5401815243</v20:criterionId>

                          <v20:insertionText>prisApp</v20:insertionText>

                          <v20:paramIndex>1</v20:paramIndex>

                       </v20:operand>


Do I need a paragraph like the one above for every single keyword in the adgroup or is it enough with one criterionId per adgroup (and not every single KW id).


I appreciate the help,


Kristian

Umesh Dengale

unread,
Apr 21, 2016, 3:17:03 PM4/21/16
to AdWords API Forum
Hi Kristian,

The AdParam.CriterionId is required field for each mutate operation for AdParams in the AdGroup. Please check out AdParam document and SetAdParameters Java example code from the client library. Other languages example code could be found here.

Cheers,
Umesh, AdWords API Team.

Kristian

unread,
Apr 25, 2016, 10:39:36 AM4/25/16
to AdWords API Forum
Hi Umesh,

Thank you very much for the reply! 

I just want to make sure I understood your answer 100% percent correctly.

Whenever I add a new keyword in an adgroup I also need to ad it to the script with it's CriterionID?

That's how I understood your answer and the documentation.

Regards,


Kristian

Umesh Dengale

unread,
Apr 25, 2016, 3:44:01 PM4/25/16
to AdWords API Forum
Hi Kristian,

You could add the AdParam for every keyword within AdGroup, but it is not mandatory. You could decide it based on your requirements. Please check out Ad Parameters and AdParam document.

Thanks,
Umesh, AdWords API Team.

Kristian

unread,
Apr 27, 2016, 9:47:32 AM4/27/16
to AdWords API Forum
Hi Umesh

Thank you Very much for the help so far. 

As I have mentioned earlier I am not a programmer and I therefore have one last question, that I hope you can help with.

I need to add AdParams for every keyword within the four adgroups.

The code for an adgroup could look like this:

                           <!-- Adgroup X -->
                       <v20:operand>
                          <v20:adGroupId>20475900539</v20:adGroupId>
                          <v20:criterionId>74868325463</v20:criterionId>
                          <v20:insertionText>prisX</v20:insertionText>
                          <v20:paramIndex>1</v20:paramIndex>
                       </v20:operand>
                       </v20:operations>

                         <v20:operations>
                            <v20:operator>SET</v20:operator>


I want to add another keyword within this adgroup (criterionId is 72984479996 ). I have tried different combinations so far but I can't run the script without getting errors. 

I hope you can help.

Sincerely,

Kristian

Shwetha Vastrad (AdWords API Team)

unread,
Apr 27, 2016, 4:31:58 PM4/27/16
to AdWords API Forum
Hi Kristian,

Could you provide the SOAP request and response logs so I can have a look at the errors and see what's going wrong? Please use Reply privately to author when responding. 

Thanks,
Shwetha, AdWords API Team.

Kristian

unread,
Apr 28, 2016, 2:04:33 PM4/28/16
to AdWords API Forum
Prrogram 2.gif.jpg

Kristian

unread,
Apr 28, 2016, 2:05:46 PM4/28/16
to AdWords API Forum


Den torsdag den 21. april 2016 kl. 15.17.51 UTC+2 skrev Kristian:
Prrogram 2.gif.jpg

Shwetha Vastrad (AdWords API Team)

unread,
Apr 28, 2016, 4:27:39 PM4/28/16
to AdWords API Forum
Hi Kristian,

Since you are trying to set parameters for different keywords, they'll be counted as different operations. That is why you are getting an error message that there is an unexpected element after "v20:operand" element. 

If you include the second operation in a new "v20:operations" element, the script should work as expected. 

It should look something like this:

<v20:operations>
       <v20:operator>SET</v20:operator>
       <v20:operand>
              <v20:adGroupId>[AdGroupId]</v20:adGroupId>
              <v20:criterionId>[KeywordId1]</v20:criterionId>
              <v20:insertionText>[paramText]</v20:insertionText>

              <v20:paramIndex>1</v20:paramIndex>
       </v20:operand>
</v20:operations>

<v20:operations>
       <v20:operator>SET</v20:operator>

       <v20:operand>
              <v20:adGroupId>[AdGroupId]</v20:adGroupId>
              <v20:criterionId>[KeywordId2]</v20:criterionId>
              <v20:insertionText>[paramText]</v20:insertionText>

              <v20:paramIndex>1</v20:paramIndex>
       </v20:operand>
</v20:operations>


Regards,
Shwetha, AdWords API Team.
Reply all
Reply to author
Forward
0 new messages