Posts tagged with google-ads-api

The install referrer library is installed in my application. Through it, I get where the user came from, respectively. I want to receive the static parameter utm_source = alexander if the user has installed the application by advertising launched in Google Ads UAC. I try to set the final url suffix at the account setup level - "referrer = utm_source% 3Dalexander". But I get "utm_source = (not set)" instead of the given parameter.

But if I go directly to the link "https://play.google.com/store/apps/details?id=...&referrer=utm_source%3DAlexander", then everything works as it should and in the statistics I see - "utm_source = Alexander ".

Can you please tell me how you can configure Google UAC correctly so that the static parameter specified in advance is passed to the application?

P.S. Auto-tagging is disabled at the account level in the settings

I'm working on converting my Kotlin App to Admob 20.1.0. Running into a problem integrating Rewarded Ads.

The problem is onUserEarnedReward is never called. I currently have no way of rewarding the user with the content they unlocked. My code below is placed in an onClickListener within an AppCompatActivity()

if (mRewardedAd != null) {     mRewardedAd?.show(this, OnUserEarnedRewardListener { // Redundant SAM-constructor         fun onUserEarnedReward(rewardItem: RewardItem) { // Function "onUserEarnedReward" is never used                          val rewardAmount = rewardItem.amount             val rewardType = rewardItem.type             println("======================= TYPE -  $rewardType /// AMOUNT - $rewardAmount")             // This never gets called.         }     }) } else {     println("=======================The rewarded ad wasn't ready yet.") } 

My imports:

import com.google.android.gms.ads.* import com.google.android.gms.ads.rewarded.RewardItem import com.google.android.gms.ads.rewarded.RewardedAd import com.google.android.gms.ads.rewarded.RewardedAdLoadCallback import com.google.android.gms.ads.OnUserEarnedRewardListener 

Why am I getting Redundant SAM-constructor and Function "onUserEarnedReward" is never used ?

I'm wanting to convert the GoogleAdsRows to json (to then put into a dataframe). when using proto.Message.to_json, i do get json, but it also returns fields that I never queried.

here's the code i'm using (I declare the credentials right before, but left that out so i can post)

import proto from google.ads.googleads.client import GoogleAdsClient credentials = {     "developer_token": developer_token,     "refresh_token": refresh_token,     "client_id": client_id,     "client_secret": client_secret,     "login_customer_id": login_customer_id} client = GoogleAdsClient.load_from_dict(credentials) ga_service = client.get_service("GoogleAdsService",version='v6') query = """         SELECT              campaign.id,             segments.device                              FROM campaign          WHERE segments.date = '20210405'         LIMIT 10 """ response = ga_service.search_stream(customer_id=customer_id, query=query) for batch in response:     for row in batch.results:         newrow = proto.Message.to_json(row,preserving_proto_field_name=True)         print(newrow) 

returns (partial shown):

    "click_type": 0,     "conversion_action_category": 0,     "conversion_attribution_event_type": 0,     "conversion_lag_bucket": 0,     "conversion_or_adjustment_lag_bucket": 0,     "day_of_week": 0,     "external_conversion_source": 0,     "hotel_check_in_day_of_week": 0,     "hotel_date_selection_type": 0,     "hotel_rate_type": 0,     "hotel_price_bucket": 0,     "month_of_year": 0,     "placeholder_type": 0,     "product_channel": 0,     "product_channel_exclusivity": 0,     "product_condition": 0, 

so, I never ask for any of the fields above, only campaign.id and segments.device, yet it returns 36 fields... any idea on how to just return the fields I requested? If I print(row) directly, i can see that it only returns the fields requested in the query, so i have no idea where it is grabbing these extra fields from.

thanks!

Edit: I tinkered around with the response a bit more and now I have some decent results, however this seems very complex considering all i want to do is take protobuf -> DataFrame..

results = [] for batch in response:     for row in batch.results:         pbrow = proto.Message.pb(row)         newrow = json_format.MessageToJson(pbrow)         evalrow = eval(newrow)         df = pd.json_normalize(evalrow)         results.append(df) print(results) 

Output (made-up campaigns/customerids):

[                      campaign.resourceName campaign.id segments.device 0  customers/1234567891/campaigns/098765432   098765432         DESKTOP,                       campaign.resourceName campaign.id segments.device 0  customers/1234567891/campaigns/987654321   987654321          MOBILE,                       campaign.resourceName campaign.id segments.device 0  customers/1234567891/campaigns/876543210   876543210          TABLET,                       campaign.resourceName campaign.id segments.device 0  customers/1234567891/campaigns/765432109   765432109         DESKTOP,                       campaign.resourceName campaign.id segments.device ] 

is there any way to simplify this? what the heck am i missing that this needs 5 transformations to combine the data stream?

I want to modify these API calls to use a GCP service account instead of my identity.

var report = AdsApp.search(searchQuery);    var table = BigQuery.Tables.insert(table, projectId, dataSetId); BigQuery.Jobs.insert(job, BIGQUERY_PROJECT_ID); 

I read this article but wasn't sure how to find the url for AdsApp and BigQuery.

I searched this post, but still haven't been sure.

Hi,

I want to write an Ads-script to call GoogleAds url nad BQ url using a service account.

I saw this code. Are my urls to the GAds and BQ api correct?

Thanks!

=====================

  // Natural Language API Sentiment URL   var url =       'https://language.googleapis.com/v1beta1/documents:analyzeEntities';   var options = {     method: 'POST',     contentType: 'application/json',     payload: JSON.stringify(body)   };   var response = authUrlFetchApp.fetch(url, options);   var result = JSON.parse(response.getContentText());   Logger.log(result);   if (result.entities) {     // return a list of identified entities     return result.entities;   }   throw Error('No entities response returned'); } 

It seems the Google Ads API Client Library (PHP in my case) can automatically handle the access tokens by using a provided refresh token.

Does this mean that the client library will end up making additional calls in order to generate a new access token on every request?

If so, would it be better if I store the access token and pass it with each request and then track when it expires and handle generating a new one myself?