Posts tagged with javascript

I'm getting to Google Ads scripts. I managed to execute this script that pauses a specific campaign but I couldn't apply this to multiple campaigns. Here is what I tried, but it only pauses the first campaign in ("Name IN ['test1', 'test2']"). Could someone help me to achieve this?

function main () {   var campaignIterator = AdsApp.campaigns()     .withCondition("Name IN ['test1', 'test2']").get();   if (campaignIterator.hasNext()) {     var campaign = campaignIterator.next();     campaign.pause();   } }

  1. When I run an ads-script to call the "spreadsheet" API. I want to enrich a sheet by duplicating some rows according to values I have in a script.

How should I do this effectively?

only by creating a new tab? Starting from the last row? As I change the range while iterating.

  for ( i = 0; i < lastColumn - 1; i++){     for ( j = 0 ; j < lastRow - 1; j++){       var kw_data = kw_to_label[rangeValues[j][i]];         if(kw_data != null){         sheet.getRange(j,i).setValue(kw_data.labels[k]);   

An example:

dict: k1 -> val1, val2 k2 -> val3 

and sheet:

Can you spot any issues with this page? There are meant to be skyscraper and leader banners throughout this article, but for some reason it's not displaying.

Any quick spots that I may have missed?

https://universitybusiness.co.uk/people-policy-politics/office-for-students-announces-details-of-nss-review/

Below is the Google Console report for the first ad slot:

When I test this query in the delivery tools, it just continually runs a loading gif.

I have added google adwords conversion code to the head of my index.html:

<!-- Global site tag (gtag.js) - Google Ads: 0000000--> <script async src="https://www.googletagmanager.com/gtag/js?id=AW-0000000"></script> <script>window.dataLayer = window.dataLayer || [];   function gtag(){dataLayer.push(arguments);}   gtag('js', new Date());   gtag('config', 'AW-0000000');</script> <!-- Event snippet for 0000000 conversion page In your html page, add the snippet and call gtag_report_conversion when someone clicks on the chosen link or button. --> <script>function gtag_report_conversion(url) {     var callback = function () {       if (typeof(url) != 'undefined') {         window.location = url;       }     };     gtag('event', 'conversion', {         'send_to': 'AW-0000000/0000000-0000000',         'event_callback': callback     });     return false;   }</script> 

The conversion should be counted when a user successfully registers. For this I need to wait for the success message in my register user api endpoint, which is called in a component:

this.http.post<any>(apiEndpoint, sendData).subscribe(data => {   console.log(data);   if (data['error']) {     this.regError = data['errortxt'];   } else {     this.regError = "";     this.dataService.REG_AUTH = data['data']['token'];     localStorage.setItem('regauth', data['data']['token']);     // Adwords Conversion     gtag_report_conversion(url);     this.navigation.loadView(this.navigation.getView('3').name);   } }, error => {   console.log(error.json()); }); 

It tells me Cannot find name gtag_report_conversion(url);

Any ideas? Somehow I need to import the function from index.html?