AdWords
2.4K members online now
2.4K members online now
For questions related to Google Shopping and Merchant Center. Learn to optimize your Shopping ads
Guide Me
star_border
Reply

Impression share at product group level in Shopping API

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

Hey!

 

Since average position isn't available for shopping ads, I want to create a script that increases the bid by 10% for product groups with an impression share that is lower than 90%.

 

I tried to use the field name "SearchImpressionShare", but it doesn't seem to work:

 

 

updateProductGroupBid();
  
function updateProductGroupBid() {
  var productGroups = AdWordsApp.productGroups()
     .withCondition("SearchImpressionShare < 90")
     .forDateRange("LAST_30_DAYS")
     .get();
  while (productGroups.hasNext()) {
    var productGroup = productGroups.next();
    productGroup.setMaxCpc(productGroup.getMaxCpc() * 1.1)

 

2 Expert replyverified_user
1 ACCEPTED SOLUTION

Accepted Solutions
Marked as Best Answer.
Solution
Accepted by topic author Simon RM
July 2016

Re: Impression share at product group level in Shopping API

[ Edited ]
Top Contributor
# 4
Top Contributor

for shopping-campaigns, impression-share is a
statistic that is currently available only via reports.

for example --

function updateshoppingimpressionshare() {

	// celebird -- update shopping-campaign cpc based on impression-share

	// TODO: more robust validation and error checking (try/catch, etc.)

	var report = AdWordsApp.report('select CampaignName, AdGroupName, ProductGroup, Id, AdGroupId, SearchImpressionShare, CpcBid from PRODUCT_PARTITION_REPORT during LAST_MONTH');
	
	var rows = report.rows();
	
	for (var irow = 0; rows.hasNext(); irow++) {

		var row = rows.next();
	
		var ishare = 0.0;
		var sshare = row["SearchImpressionShare"];
		if (sshare != "--")
			ishare = parseFloat(sshare);
	
		var cpcbid = 0.0;
		var sbid = row["CpcBid"];
		if (sbid != "--")
			cpcbid = parseFloat(sbid);
	
		var scampaign = row["CampaignName"].toString();
		var adgroup = row["AdGroupName"].toString();
		var productgroup = row["ProductGroup"].toString();
	
		var gid = row["AdGroupId"];
		var pid = row["Id"];

		// DEBUG prg();

		// some (report) action criteria and action goes here
		if (ishare < 90.0 && cpcbid == 0.1) {
	
			Logger.log("possible action with impression-share: " + ishare);
			prg();

			var xg = AdWordsApp.productGroups().withIds([[gid, pid]]);
			var pg = xg.get();
			var ng = pg.totalNumEntities();

			if (ng != 1) {
				Logger.log("cannot take action with impression share: group entities");
			}
	
			if (ng == 1) {
				Logger.log("one entity action for this impression-share: " + ishare);

				var actionGroup = pg.next();
	
				var checkcpc = actionGroup.getMaxCpc();
	
				if (checkcpc != cpcbid) {
					Logger.log("cannot take action on impression share: check failed!");
				} else {
					Logger.log("CAUTION: taking action on impression share ...");

					// some new max cpc for the action criteria goes here
					var newMaxCpc = checkcpc * 1.1;

					Logger.log("CAUTION: setting new max-cpc as " + newMaxCpc);

					// uncomment next line to exec
					// actionGroup.setMaxCpc(newMaxCpc);
				}
	
			}
		}
	}
	Logger.log("###");

	function prg() {
		Logger.log("# this row = " + irow);
		Logger.log("CAMPAIGN: " + scampaign);
		Logger.log("AD-GROUP: " + adgroup);
		Logger.log("AD-GROUP-ID: " + gid);
		Logger.log("PRODUCT-GROUP: " + productgroup);
		Logger.log("PRODUCT-GROUP-ID: " + pid);
		Logger.log("CPC-BID: " + cpcbid);
		Logger.log("I-SHARE: " + ishare);
		Logger.log("");
	}
} // updateshoppingimpressionshare


any follow-up questions are likely better asked
within the adwords-scripts forum/help-group --
https://groups.google.com/forum/#!forum/adwords-scripts

View solution in original post

Re: Impression share at product group level in Shopping API

Rising Star
# 2
Rising Star
Looking at the reference below (link) it does not seem to be part of withCondition option, so what you are trying to do will not work.
https://developers.google.com/adwords/scripts/docs/reference/adwordsapp/adwordsapp_campaignselector#...

Hope it helps
Twitter | Linkedin | Community Profile | Shopping Feed Tips From FeedArmy
Did you find any helpful responses or answers to your query? If yes, please click on ‘Accept As Solution’

Re: Impression share at product group level in Shopping API

Visitor ✭ ✭ ✭
# 3
Visitor ✭ ✭ ✭
Ok, thanks.

Is there another way of using AdWords API to bid higher on product groups when impression share drops below a certain threshold?
Marked as Best Answer.
Solution
Accepted by topic author Simon RM
July 2016

Re: Impression share at product group level in Shopping API

[ Edited ]
Top Contributor
# 4
Top Contributor

for shopping-campaigns, impression-share is a
statistic that is currently available only via reports.

for example --

function updateshoppingimpressionshare() {

	// celebird -- update shopping-campaign cpc based on impression-share

	// TODO: more robust validation and error checking (try/catch, etc.)

	var report = AdWordsApp.report('select CampaignName, AdGroupName, ProductGroup, Id, AdGroupId, SearchImpressionShare, CpcBid from PRODUCT_PARTITION_REPORT during LAST_MONTH');
	
	var rows = report.rows();
	
	for (var irow = 0; rows.hasNext(); irow++) {

		var row = rows.next();
	
		var ishare = 0.0;
		var sshare = row["SearchImpressionShare"];
		if (sshare != "--")
			ishare = parseFloat(sshare);
	
		var cpcbid = 0.0;
		var sbid = row["CpcBid"];
		if (sbid != "--")
			cpcbid = parseFloat(sbid);
	
		var scampaign = row["CampaignName"].toString();
		var adgroup = row["AdGroupName"].toString();
		var productgroup = row["ProductGroup"].toString();
	
		var gid = row["AdGroupId"];
		var pid = row["Id"];

		// DEBUG prg();

		// some (report) action criteria and action goes here
		if (ishare < 90.0 && cpcbid == 0.1) {
	
			Logger.log("possible action with impression-share: " + ishare);
			prg();

			var xg = AdWordsApp.productGroups().withIds([[gid, pid]]);
			var pg = xg.get();
			var ng = pg.totalNumEntities();

			if (ng != 1) {
				Logger.log("cannot take action with impression share: group entities");
			}
	
			if (ng == 1) {
				Logger.log("one entity action for this impression-share: " + ishare);

				var actionGroup = pg.next();
	
				var checkcpc = actionGroup.getMaxCpc();
	
				if (checkcpc != cpcbid) {
					Logger.log("cannot take action on impression share: check failed!");
				} else {
					Logger.log("CAUTION: taking action on impression share ...");

					// some new max cpc for the action criteria goes here
					var newMaxCpc = checkcpc * 1.1;

					Logger.log("CAUTION: setting new max-cpc as " + newMaxCpc);

					// uncomment next line to exec
					// actionGroup.setMaxCpc(newMaxCpc);
				}
	
			}
		}
	}
	Logger.log("###");

	function prg() {
		Logger.log("# this row = " + irow);
		Logger.log("CAMPAIGN: " + scampaign);
		Logger.log("AD-GROUP: " + adgroup);
		Logger.log("AD-GROUP-ID: " + gid);
		Logger.log("PRODUCT-GROUP: " + productgroup);
		Logger.log("PRODUCT-GROUP-ID: " + pid);
		Logger.log("CPC-BID: " + cpcbid);
		Logger.log("I-SHARE: " + ishare);
		Logger.log("");
	}
} // updateshoppingimpressionshare


any follow-up questions are likely better asked
within the adwords-scripts forum/help-group --
https://groups.google.com/forum/#!forum/adwords-scripts