Posts tagged with google-ads-script

We are sending enhanced conversions to Google ADS API using the Upload Click Conversions method of the API client. This is the only data we send to API. No user identifier data about customers is sent to API before that via GTM. In Google Ads UI measurements, I see that Google only shows 5% of what actual conversions are. Does this mean we need to send Google Ads API some information through GTM before we send the conversions through the API client?

I try to make a keyword searches system for our employ and i have google ads developer token But I cannot able to find any CURL or PHP CURL setup guide.

Two reference links Ad API Examples
Method: customers.generateKeywordIdeas

An example from Google's documentation:

curl -f --request POST "https://googleads.googleapis.com/v${API_VERSION}/customers/${CUSTOMER_ID}/campaignBudgets:mutate" \ --header "Content-Type: application/json" \ --header "developer-token: ${DEVELOPER_TOKEN}" \ --header "login-customer-id: ${MANAGER_CUSTOMER_ID}" \ --header "Authorization: Bearer ${OAUTH2_ACCESS_TOKEN}" \ --data "{ 'operations': [   {     'create': {       'name': 'My Campaign Budget #${RANDOM}',       'amountMicros': 500000,     }   },   {     'create': {       'name': 'My Campaign Budget #${RANDOM}',       'amountMicros': 500000,     }   } ] }" 

I try this code but got Error

    <?          $ch = curl_init();          curl_setopt($ch, CURLOPT_URL, 'https://googleads.googleapis.com/v11/customers/(MANAGER_CUSTOMER_ID):generateKeywordIdeas');     curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);     curl_setopt($ch, CURLOPT_POST, 1);     curl_setopt($ch, CURLOPT_POSTFIELDS, "{\n\n\"keywordSeed\": {\n    \"keywords\": [\n    \"cofee\"\n  ]\n  }\n}");          $headers = array();     $headers[] = 'Content-Type: application/json';     $headers[] = 'Login-Customer-Id: (MANAGER_CUSTOMER_ID)';     $headers[] = 'Developer-Token: DEVELOPER_TOKEN';     $headers[] = 'Authorization: Bearer (OAUTH_ACCESS_TOKEN)';     curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);          $result = curl_exec($ch);     if (curl_errno($ch)) {         echo 'Error:' . curl_error($ch);     }     print_r($result);     curl_close($ch); 

I'm not getting any output

Recently I have been trying to create a script to retrieve either an accounts or individual campaigns optimisation scores and subsequently send a email including this. My problem is that I cannot find optimisation score in stats or metrics anyway I try.

Does anyone know if this is even a retrievable variable in scripts?

I want to add new columns to the Account Summary Report: https://developers.google.com/google-ads/scripts/docs/solutions/account-summary

But I'm getting an error.

'report_fields': [ {'columnName': 'metrics.cost_micros', 'displayName': 'Cost'}, {'columnName': 'metrics.average_cpc', 'displayName': 'Avg. CPC'}, {'columnName': 'metrics.ctr', 'displayName': 'CTR'}, {'columnName': 'metrics.search_impression_share', 'displayName': 'Search Impr. share'}, {'columnName': 'metrics.impressions', 'displayName': 'Impressions'}, {'columnName': 'metrics.clicks', 'displayName': 'Clicks'}, {'columnName': 'metrics.conversions', 'displayName': 'Conversions'}, {'columnName': 'metrics.conversions_value', 'displayName': 'Revenue'}, {'columnName': 'metrics.cost_per_conversion', 'displayName': 'CPA'}, {'columnName': 'metrics.conversions_from_interactions_rate', 'displayName': 'CVR'} 

--- Error---

Error: Unknown field metrics.conversions     at format (Code:174:13)     at Code:97:33     at Array.map (<anonymous>)     at main (Code:96:55) 

I have the following "standard" google site tag tracking conversions on my page:

<!-- Google Code for sale Conversion Page --> <script type="text/javascript"> /* <![CDATA[ */ var google_conversion_id = AW-MYAWID; var google_conversion_language = "en"; var google_conversion_format = "3"; var google_conversion_color = "ffffff"; var google_conversion_label = "MY_LABEL"; if (1.0) {   var google_conversion_value = <?php echo round($order_total['value'],2);?>; } var google_remarketing_only = false; /* ]]> */ </script> script type="text/javascript" src="//www.googleadservices.com/pagead/conversion.js"> </script> <noscript> <div style="display:inline;"> <img height="1" width="1" style="border-style:none;" alt="" src="//www.googleadservices.com/pagead/conversion/AW-MYAWID/?value=<?php echo round($order_total['value'],2);?>&amp;label=MY_LABEL&amp;guid=ON&amp;script=0"/> </div> </noscript> 

Directly below that I have:

  <script type="text/javascript">         gtag('event', 'conversion', {             'send_to': 'AW-MYAWID/MYLABEL',             'value': <?php echo round($order_total['value'],2);?>,             'currency': 'CAD',             'transaction_id': ''         });     </script>     <!--google enhanced conversions !-->     <script type="text/javascript">         gtag('set', 'user_data', {             "email":  <?php echo $customer_info['email_address'];?>,             "phone_number": <?php echo $customer_info['telephone'];?>,             "address": {             "first_name": <?php echo $customer_info['firstname']; ?>,                 "last_name": <?php echo $customer_info['lastname']; ?>,                 "street":  <?php echo $customer_info['street_address'];?>,                 "city":<?php echo $customer_info['city'];?>,                 "region": <?php echo $customer_info['state'];?>,                 "postal_code": <?php echo $customer_info['postcode'];?>         }         });     </script> 

This is in my header:

<script async src="https://www.googletagmanager.com/gtag/js?id=UA-MYUAUD"></script> <script>     window.dataLayer = window.dataLayer || [];     function gtag(){dataLayer.push(arguments);}     gtag('js', new Date());     gtag('config', 'AW-MYAWID') ;     gtag('config', 'UA-MYUAUD'); </script> 

in tag assistant the CDATA tag is showing but for the global site tag it shows the tag with no metadata etc. am I missing something? Why is only the standard version seem to fire the event?