Using TargetingIdeaService to return the data for the actual search term provided.

446 views
Skip to first unread message

Jeremy Tremblay

unread,
May 12, 2014, 4:10:00 PM5/12/14
to adwor...@googlegroups.com
Currently I am using the TargetingIdeaService to provide a subset of the functionality of the Keyword Planner by providing a list of locations and a RelatedToQuerySearchParameter query to TargetingIdeaService.get to get a list of keywords and their associated data, as one might in the "Search for new keyword and ad group ideas" section of the tool.  The results returned by the tool on the "Keyword Ideas" tab include the "Search Term" data as well as a list of "Keywords" and their data. 

My use of TargetingIdeaService.get is returning the list of "Keywords" just fine, but I can't seem to get the "Search Term" data to come through. Does anyone know how I might go about doing that? Is it perhaps due to the paging limitations of TargetingIdeaService.get  and I need more than 800 results to get a TargetingIdeaPage that includes an entry where the KEYWORD_TEXT matches the RelatedToQuerySearchParameter query "Search Term" exactly? 


Any help is appreciated,

-jt-

Ray Tsang (AdWords API Team)

unread,
May 13, 2014, 2:11:20 PM5/13/14
to adwor...@googlegroups.com
Jeremy,

To make sure I'm on the same page - could I trouble you to attach a screenshot of the search term that you are referring to?

Thanks,

Ray

Jeremy Tremblay

unread,
May 13, 2014, 3:58:12 PM5/13/14
to adwor...@googlegroups.com


Ray, see attached. I am using the following to get a TargetingIdeaPage which generally contains all the data in that screen snap under the "Keyword (by relevance)" section. I'm having issues getting the data under the "Search Terms" section to come though on the TargetingIdeaPage:


               // Get the TargetingIdeaService.

TargetingIdeaServiceInterface targetingIdeaService = adWordsServices.get(session, TargetingIdeaServiceInterface.class);


// Create category products and services search parameter

CategoryProductsAndServicesSearchParameter categoryProductsAndServicesSearchParameter = new CategoryProductsAndServicesSearchParameter();

categoryProductsAndServicesSearchParameter.setCategoryId(10018);


// Create related to query search parameter.

RelatedToQuerySearchParameter relatedToQuerySearchParameter = new RelatedToQuerySearchParameter();

relatedToQuerySearchParameter.setQueries(new String[] {searchTerm});


//Location

int locationsSize = locationIds.size();

Location[] locations = new Location[locationsSize];


for (int i = 0; i < locationsSize; i++) {

Location location = new Location();

location.setId(locationIds.get(i).longValue());

locations[i] = location;

}


LocationSearchParameter locationSearchParameter = new LocationSearchParameter();

locationSearchParameter.setLocations(locations);


//Google only

NetworkSearchParameter networkSearchParameter = new NetworkSearchParameter();

networkSearchParameter.setNetworkSetting(new NetworkSetting(true, false, false, false));


// Create selector.

TargetingIdeaSelector selector = new TargetingIdeaSelector();

selector.setRequestType(RequestType.IDEAS);

selector.setIdeaType(IdeaType.KEYWORD);

selector.setSearchParameters(new SearchParameter[] {relatedToQuerySearchParameter, categoryProductsAndServicesSearchParameter, locationSearchParameter, networkSearchParameter});

selector.setRequestedAttributeTypes(new AttributeType[] {

AttributeType.KEYWORD_TEXT,

AttributeType.COMPETITION,

AttributeType.SEARCH_VOLUME,

AttributeType.AVERAGE_CPC});


//800 is the MAX here. 

// Set selector paging (required for targeting idea service).

Paging paging = new Paging();

paging.setStartIndex(0);

paging.setNumberResults(800);

selector.setPaging(paging);

TargetingIdeaPage page = targetingIdeaService.get(selector);

I am using 
searchterm.png

Ray Tsang (AdWords API Team)

unread,
May 14, 2014, 5:54:40 AM5/14/14
to adwor...@googlegroups.com
Jeremy,

The "search terms" field in the UI should be exactly the same string you entered in the previous step (in the "Your product or service" field).  It is an user input.

It should be the same value as what you have in setQuery(...).

Cheers,

Ray

Jeremy Tremblay

unread,
May 14, 2014, 11:34:13 AM5/14/14
to adwor...@googlegroups.com
"It should be the same value as what you have in setQuery(...)"

Yes, that is what I expect. But it does not come back in my TargetingIdeaPage as a TargetingIdea for every search term I use. 

For example when I use "bakruptcy" as my search term, I can find A TargetingIdea in my TargetingIdeaPage with a KEYWORD_TEXT attribute of "bankrputcy", yet if I use "adoption", I cannot. 

Is this a paging issue? Should I be making multiple calls to targetingIdeaService.get?

Ray Tsang (AdWords API Team)

unread,
May 15, 2014, 6:29:35 AM5/15/14
to adwor...@googlegroups.com
Jeremy,

The returned result are not expected to return the same "search terms", but rather, keyword ideas.  I.e., for a given term, the idea may not always be the same as the original term.

Thanks,

Ray

Jeremy Tremblay

unread,
May 15, 2014, 11:07:53 AM5/15/14
to adwor...@googlegroups.com
Which brings me back to my original question: How do I get the data for the Search Term??

If you look at the screenshot I provided, there is data in the "Search terms" section. How do I use the API to get that data? The Keyword Tool provides data in that section no matter what Search Term I use. I need to replicate this behavior using the API. How do I do that? 

-jt-

Jeremy Tremblay

unread,
May 15, 2014, 3:42:04 PM5/15/14
to adwor...@googlegroups.com
Forget it, I got it. 

I need a separate call to TargetingIdeaServiceInterface.get with 

selector.setRequestType(RequestType.STATS);

instead of IDEAS

and 

Paging paging = new Paging();

paging.setStartIndex(0);

paging.setNumberResults(1);

selector.setPaging(paging);


Thanks for your help again Ray!


-jt-

Reply all
Reply to author
Forward
0 new messages