Posts under category Google

I'm trying to understand the geo performance report in the Adwords API. Specifically, this note is tripping me up

Note: If you request both IsTargetingLocation values in your predicate and either do not limit by LocationType or request both LocationType values in your predicate, then the same impression's statistics may appear in multiple rows of the report. Therefore, statistic totals from your report could be much higher than totals from other reports such as the CAMPAIGN_PERFORMANCE_REPORT.

The way I understand it is, campaigns have a target location like New York. The field IsTargetingLocation can be true or false, where true means the corresponding impressions occurred in the target location and false means they didn't.

Additionally, the field LocationType can be either "Location of interest" (someone in Alabama is interested in New York) or "Physical location".

How can including both of these fields create double-counting? Someone is either in New York (IsTargetingLocation = true and LocationType = "Physical location") or they aren't (IsTargetingLocation = false and LocationType = "Location of interest").

I am trying to use the python googleads module in a script on Spyder.

I have run pip install googleads and the installation has succeeded.

However, when I try to import googleads in the script on Spyder, it gives me the below error:

ModuleNotFoundError: No module named 'googleads'

I have uninstalled the package and run pip install googleads again. The installation succeeds this time as well but the above error persists.

I have tried using conda install as well. That does not install the package.

However, when I run the script on the command prompt, it works fine. The issue is only with Spyder.

I have also Googled and looked up StackOverflow and most other communities for a solution to this but haven't been able to find one :(

Looking forward to some help here, to fix the issue.

Thank you in advance!

PS: I have run the pip install on the Anaconda prompt as well and that succeeds too. The error on Spyder still exists.

I have created google adCampaigns, adGroups, Keywords, Ads, Locations using Google Adwords API but I am not able to set "Set a maximum cost per click bid limit" using api

I have used this code to set but it's not getting set

       $operations = [];         // Create ad group with the specified ID.         $groupId = $adGroup->getId();         $adGroupNew = new AdGroup();         $adGroupNew->setId($groupId);         $cpcBidMicroAmount = intval($_GET['cpc']) * 1000000;         // Update the CPC bid if specified.         if (!is_null($cpcBidMicroAmount)) {             $bid = new CpcBid();             $money = new Money();             $money->setMicroAmount($cpcBidMicroAmount);             $bid->setBid($money);             $biddingStrategyConfiguration = new BiddingStrategyConfiguration();             $biddingStrategyConfiguration->setBids([$bid]);             $adGroup->setBiddingStrategyConfiguration($biddingStrategyConfiguration);         }         // Create ad group operation and add it to the list.         $operation = new AdGroupOperation();         $operation->setOperand($adGroupNew);         $operation->setOperator(Operator::SET);         $operations[] = $operation;         // Update the ad group on the server.         $adGroupService->mutate($operations); 

I have included the needed script tag in the global template.html file which contains all dynamic pages for my SPA (written in Sapper/Svelte).

www.ensueco.com

<script data-ad-client="ca-pub-XXXXXXXXXXXXXXXX" async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script> 

​If I load the index page, auto ads load perfectly, but when I click a link navigating to another page/article, client-side routing will change the content in the content window, but won't recreate new autogenerated ads.

If I open a given article/subpage as initial page load, it also loads ads from auto ads perfectly, but clicking "home" in main navigation going back to the homepage, doesn't load new ads in the content window.

Q: How do I ask the adsbygoogle script to execute again on client-side routing to fill in auto ads on all pages?

I currently have a script that subscribes to route change events and forward these informations to Google Analytics:

page.subscribe(({ path, params, query }) => { gtag("config", "GOOGLE_ANALYTICS", { page_path: path }); }); 

But not sure if I could do something similar in this to ask adsbygoogle to execute again? (below code has been tested and doesn't work)

page.subscribe(({ path, params, query }) => { // (window.adsbygoogle = []).push({ // google_ad_client: "ca-pub-XXXXXXXXXXXXX", // enable_page_level_ads: true, // tag_partner: "site_kit" // }); gtag("config", "GOOGLE_ANALYTICS", { page_path: path }); }); 

Above code at testing gives me this:

I get this error on route change then:

Uncaught O {message: "adsbygoogle.push() error: Only one 'enable_page_level_ads' allowed per page.", name: "TagError", pbr: true, stack: "TagError: adsbygoogle.push() error: Only one 'enab…esyndication.com/pagead/js/adsbygoogle.js:58:409)"} 

And if I remove the enable_page_level_ads I get this:

Uncaught  O {message: "adsbygoogle.push() error: All ins elements in the … with class=adsbygoogle already have ads in them.", name: "TagError", pbr: true, stack: "TagError: adsbygoogle.push() error: All ins elemen…js/adsbygoogle.js:185:25)↵    at <anonymous>:1:38"} 

So basically, I need to execute some method that creates new tags (based on auto ads) so I can execute this method and populate all the new ins elements. I think.

Thanks


ADDITIONAL THOUGHTS

From what I understand, the script is loaded post SSR (server-side rendering), why the content, HTML, CSS, and JS from my site already is loaded once the adsbygoogle script is executed.

From a development POW, I would expect it to be possible to empty the adsbygoogle array and re-initialize the ads by google script in order for the JS, to crawl the now dynamically loaded content and based on the new window.pushed URI (window.history.pushState()), and place new ads as it would have done anyway, should it have been loaded after this particular page's SSR.