Git Product home page Git Product logo

node-adwords's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

node-adwords's Issues

Can't get access token

Hello, @ChrisAlvares
I couldn't get access token.
Can you help me?
This is my code.

let auth = new AdwordsAuth({
    client_id: config.Adwords.CLIENT_ID, //this is the api console client_id
    client_secret: config.Adwords.CLIENT_SECRET_KEY
}, 'http://localhost:55980/service/adwords_account/auth' /** insert your redirect url here */ );



service.post('/service/authenticate', (req, res, next) => {

    res.redirect(auth.generateAuthenticationUrl()); 
}

service.get('/service/adwords_account/auth', (req, res) => {
    console.log(auth.generateAuthenticationUrl());
    console.log('tokens...');
    auth.getAccessTokenFromAuthorizationCode(req.query.code, (err, tokens) => {
        //save access and especially the refresh tokens here
        console.log(err);
        console.log(tokens);
        if(err) {
            res.json({err: auth});
        } else {
            if(tokens) {
                var user = new AdwordsUser({
                    developerToken: config.Adwords.DEVELOPER_TOKEN, 
                    userAgent: 'Neefla Technologies Ltd.',
                    clientCustomerId: clientCustomerId,
                    client_id: config.Adwords.CLIENT_ID, 
                    client_secret: config.Adwords.CLIENT_SECRET_KEY,
                    refresh_token: config.Adwords.CLIENT_REFRESH_TOKEN,
                    access_token: token.access_token 
                });
                //return auth object
                res.json({user: user});

                //res.json({token: token});

            } else {
                res.json({token_err: err});
            }
        }
    });
});

But access token is null.
What am I wrong?
Thanks.

LanguageSearchParameter

Is there a way to use the LanguageSearchParameter when using the TargetingIdeaService?
I went through the API doc but I keep getting an "Unmarshalling Error: cvc-complex-type.2.4.a" error.

Here is my selector:

let selector = {
  searchParameters: [
    {
      attributes: {'xsi:type': 'RelatedToQuerySearchParameter'},
      queries: ['test']
    },
    {
      attributes: {'xsi:type': 'LanguageSearchParameter'},
      languages: [{id: 1000}]
    }
  ],
  ideaType: 'KEYWORD',
  requestType: 'IDEAS',
  requestedAttributeTypes: ['KEYWORD_TEXT'],
  paging: {startIndex: 0, numberResults: AdwordsConstants.RECOMMENDED_PAGE_SIZE},
}

I can't seem to see what's wrong especially since the request is identical to the one sent with the official PHP or Python client.

Links to Google Adwords API doc:
https://developers.google.com/adwords/api/docs/reference/v201607/TargetingIdeaService.LanguageSearchParameter
https://developers.google.com/adwords/api/docs/reference/v201607/TargetingIdeaService.Language

Cannot create expanded text ad

Hello!
I'm trying to create ExpandedTextAd following official python examples.
So far i've created such method for creating ad:

function createAdGroupAd(adGroup, appearance) {
  const newAd = {
    'xsi:type': 'AdGroupAd',
    adGroupId: adGroup.id,
    ad: {
      'xsi:type': 'ExpandedTextAd',
      headlinePart1: appearance.headLine1,
      headlinePart2: appearance.headLine2,
      description: appearance.linkDescription,
      path1: appearance.path1,
      path2: appearance.path2,
      finalUrls: [
        'http://www.example.com/cruise/space/',
        'http://www.example.com/locations/mars/'
      ]
    },
    status: 'PAUSED'
  }

  const adOperation = {
    operator: 'ADD',
    operand: newAd
  }

  return adGroupAdService.mutateAsync({ operations: [adOperation] })
}

Where adGroup is sucessfully created adGroup.
But i'm getting such error:

Error: soap:Client: Unmarshalling Error: cvc-complex-type.2.4.d: Invalid content was found starting with element 'finalUrls'. No child element is expected at this point.
Any idea what can it be?

Invalid content was found starting with element

hi, i am try create a shopping campaign but i get this error:
'Unmarshalling Error: cvc-type.2: The type definition cannot be abstract for element settings. '

When I read the older problems add to my code the Type parameter but now I get the following error:
Unmarshalling Error: cvc-complex-type.2.4.a: Invalid content was found starting with element \'budget\'

Any idea of the problem?
there go my code:

const OPERATOR  = {ADD:'ADD',REMOVE:'REMOVE',SET:'SET'}; 
let campaignService = user.getService('CampaignService','v201702')
let budgetService = user.getService('BudgetService','v201702');

function createShoppingCamp(){
    var MERCHANT_ID = xxxxxxxx;
   
    createBudget(function (b) {
       
     
        var shoppingCamp = {
            name : 'SHOPPING Camp ' + Date.now() ,
            status : 'PAUSED',
            settings : {
                 merchantId:MERCHANT_ID,
                salesCountry:'US',
                campaignPriority:0,
                enableLocal:true,
                'xsi:type': 'ShoppingSetting'
            },
            advertisingChannelType : 'SHOPPING',
            budget: {
                    budgetId:  b.budgetId // this is a valid budget id.
            },
            biddingStrategyConfiguration : {biddingStrategyType: 'MANUAL_CPC'}
             
        };
        var newShoppingCampOp = {
            operator : OPERATOR.ADD,
            operand : shoppingCamp
        };
            
   
        campaignService.mutate({operations: [newShoppingCampOp]}, (error, result) => {...})

    })

    
}

createShoppingCamp();

I appreciate the help!

Where to pass access_token

Where do I pass the access_token I receive from getAccessTokenFromAuthorizationCode()?

I keep getting AuthorizationError.USER_PERMISSION_DENIED when calling campaignService.get().

I'm trying to establish my first API call to AdWords and pull some campaign data. Here is the code that throws the permission error.

let auth = new AdwordsAuth({
    client_id: 'xxx',
    client_secret: 'xxx'
}, 'http://localhost:3000/adwords/auth' /** insert your redirect url here */);

app.get('/', (req, res) => {
    res.redirect(auth.generateAuthenticationUrl());
})
app.get('/adwords/auth', (req, res) => {
    auth.getAccessTokenFromAuthorizationCode(req.query.code, (error, tokens) => {
        console.log('tokens...');
        console.logFull({ error, tokens });
        //save access and especially the refresh tokens here

          let user = new AdwordsUser({
              developerToken: 'xxxx', //your adwords developerToken
              userAgent: 'xxx', //any company name
              clientCustomerId: 'xxxx', //the Adwords Account id (e.g. 123-123-123)
              client_id: 'xxxx', //this is the api console client_id
              client_secret: 'xxxx',
              refresh_token: tokens.refresh_token,
          });

          let campaignService = user.getService('CampaignService', 'v201702');
  
          let selector = {
              fields: ['Id', 'Name'],
              ordering: [{field: 'Name', sortOrder: 'ASCENDING'}],
              paging: {startIndex: 0, numberResults: AdwordsConstants.RECOMMENDED_PAGE_SIZE}
          };

          campaignService.get({ serviceSelector: selector }, (error, result) => {
              console.log(result.body);
              res.send(result)
          });
    })
});

Maximum call stack size exceeded on a service

function createFeedItems(feed) {
	var feedItemService = AdWordUser.getService('FeedItemService', 'v201609');
	var feedId = feed.feedId;

	var attributes = [{
		feedAttributeId: "1",
		stringValue: "testname"
	},{
		feedAttributeId: "2",
		stringValue: "testprice"
	},{
		feedAttributeId: "3",
		stringValue: "testdate"
	}];

	// create feedItem with created attributes
	var feedItem = createFeedItem(feedId, attributes, target);
	
	let op = {
		operator: "ADD",
		operand: feedItem //filling in null returns same error
	}
	
	try {
	feedItemService.mutate({ operations: [op] }, feedItemsCreated);
	
	}catch(error){
		console.log(error);
	}
}

So i am debugging this for the whole day but it always returns the following error:
node_modules/soap/lib/wsdl.js:1924
WSDL.prototype.findChildSchemaObject = function(parameterTypeObj, childName) {
^RangeError: Maximum call stack size exceeded

As you can see even if i fill in null it returns the callstack error.

any valid documentation?

hi i tried to create a campaign, budget ad etc..
problem is even after using php library as a reference i cant manage to do so.
any where i can see examples?

Cannot create feed items from api

i have been trying for 2 days to be able to create Feed Items from api but without success. it looks like feed item format is not correct. the error that i am getting currently is :
if ((childNsURI.match("http://schemas.microsoft.com") === null) || isInsideSchemaMS) {
^ RangeError: Maximum call stack size exceeded
and below is my code...

    ` let attributes = [
                {feedAttributeId:1,stringValue:"my awesome site "},
                {feedAttributeId:5,stringValues:["http://www.google.com/about"]}
            ];
    let feedItem = {
        feedId:55897084,//site link feed 
        status: 'UNKNOWN',
        attributeValues: attributes
    };

    let feedOperation = {
        operator: 'ADD',
        operand: feedItem
    };

    try {

      feedItemService.mutate({operations:[feedOperation]}, (error, Result) => {
        console.log("done");
        console.log(Result);
        console.log(error);
      });

    }catch(err){
      console.log(err);
    }`

please kindly help

Create campaign - Help please!

I need create a new campaign, i am new with this api. Can give me a sample of how to do this please?

Thank you so much

dateRangeType bug

Hi,
How could I change the dateRangeType in AdwordsReport?
It seems like no matter what value I pass it sets to 'CUSTOM_DATE'.

Thank you.

Need help?

This is such a valuable library. Do you want help maintaining it?

Using AWQL with reports

does node-adwords support it?,

Moreover, any good suggest to handle microAmount value??
I am willing to get the normal value instead of that.

create campaign

Hello all,

I am trying to create a new campaign with the API, and I get this error:
"Client: Unmarshalling Error: cvc-complex-type.2.4.a: Invalid content was found starting with element 'budget'......."
I understand from other issues that this problem is about the order of the object.
this is the object that I am trying to use:
{
operations: [{
operator: 'ADD',
operand: {
name: "masho",
status: "PAUSED",
advertisingChannelType: 'SEARCH',
biddingStrategyConfiguration: {
biddingStrategyType: 'MANUAL_CPC'
},
budget: {
budgetId: 2085008246 //this is a budgetId that i create before (tried as string and as a number) .
}
}
}]
}

Can anyone tell me what is the problem? I am trying to solve this for hours.
And also, there is anyone knows where can I find an example for every request order?

thanks,
Shlomi

Support of batch jobs?

Hi,

Could you help me, how I can send a batch package back to the url I get through "batchJobService"?

Thx,
Oppkij

Read me has a link to a 404

Hello, just a heads up. "auth" in "The main adwords user object follows the auth parameters of the PHP library." links to a 404.
Thanks

Can not set predicates to selector

serviceSelector for CampaignService version v201708 look like this:
{ fields: ['Id', 'Name'], ordering: [{field: 'Name', sortOrder: 'ASCENDING'}], paging: {startIndex: 0, numberResults: AdwordsConstants.RECOMMENDED_PAGE_SIZE}, predicates: [{ field: 'CampaignId', operator: 'IN', values: [623541753] }] }
and get error:
Error: soap:Client: Unmarshalling Error: cvc-complex-type.2.4.d: Invalid content was found starting with element 'predicates'. No child element is expected at this point.

Cannot install on Node 7.0.0

npm install node-adwords --save
npm WARN deprecated [email protected]: use uuid module instead

[email protected] install c:\xxx\node_modules\ursa
node-gyp rebuild

c:\xxx\node_modules\ursa>if not defined npm_config_node_gyp (node "c:\xxx\nvm\v7.0.0\node_modules\npm\bin\node-gyp-bin\....\node_modules\node-gyp\bin\node-gyp.js" rebuil
d ) else (node "" rebuild )
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
ursaNative.cc
win_delay_load_hook.cc
LINK : fatal error LNK1181: cannot open input file 'C:\OpenSSL-Win32\lib\libeay32.lib' [c:\xxx\node_modules\ursa\build\ursaNative.vcxproj]
gyp ERR! build error
gyp ERR! stack Error: C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe failed with exit code: 1
gyp ERR! stack at ChildProcess.onExit c:\xxx\nvm\v7.0.0\node_modules\npm\node_modules\node-gyp\lib\build.js:276:23)
gyp ERR! stack at emitTwo (events.js:106:13)
gyp ERR! stack at ChildProcess.emit (events.js:191:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)
gyp ERR! System Windows_NT 6.1.7601
gyp ERR! command "C:\Program Files\nodejs\node.exe" c:\xxx\nvm\v7.0.0\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "rebuild"
gyp ERR! cwd c:\xxx\node_modules\ursa
gyp ERR! node -v v7.0.0
gyp ERR! node-gyp -v v3.4.0
gyp ERR! not ok
c:\xxx
`-- [email protected]

npm WARN [email protected] No repository field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\ursa):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] install: node-gyp rebuild
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1

Creating Audience

Im trying to create new CrmBasedUserLists but I am having trouble on getting the right Objects for doing this.

So far I have:
var nodeAdwords = require("node-adwords")
const AdwordsConstants = require('node-adwords').AdwordsConstants;
const AdwordsUser = require('node-adwords').AdwordsUser;
const CrmBasedUserList = require('node-adwords').CrmBasedUserList;

`function(user) {
let userListService = user.getService('AdwordsUserListService', 'v201802')
console.log(userListService)
let customAudience = new CrmBasedUserList ({
'xsi:type' : 'CrmBasedUserList',
name: 'Test CRM Audiencia',
description: 'Audienca creada por Node.js',
membershiplifespan: '90L',
uploadkeytype: 'CONTACT_INFO'
})
let listOperation = {
operator: 'ADD',
operand: customAudience
}

	return userListService.mutateAsync({ operations: [listOperation] })
}`

I dont know If Im missing a require, or if the anme of the Object Im ussing is wrong or does not exist on the SDK.

Thanks!

How do you call CustomerService.getCustomers()

Once the user did OAuth, I want to know the user's client customer id using refresh/access token. I am able achieve this in Java client lib like below.

AdWordsServicesInterface adWordsServices = AdWordsServices.getInstance();
CustomerServiceInterface customerServiceInterface = adWordsServices.get(session, CustomerServiceInterface.class);
Customer[] customers = customerServiceInterface.getCustomers();

Please guide me how do I do it as I am new to node.js

Refresh token

Hi,

Im having trouble finding out how to generate a refresh token, any idea where i can do this? I already have my client id and client secret setup.

Error of auth.js

File: adwords/auth.js
in line 2:
var OAuth2 = google.auth.OAuth2;

In fact there should be
var OAuth2 = google.google.auth.OAuth2;

how to add includeZeroImpressions to http header/.

From adword API Documentation:

To include zero impressions in your report output, set the includeZeroImpressions HTTP header to true.
When set to true, reports will not exclude any rows based on metric values, and will include those with zero impressions.

But how can I set includeZeroImpressions HTTP header?

Adding Predicates to GET operations

I have the following code:

function getAdGroup (req, res) {
  let user = new AdwordsUser(adwordsConfig)
  let { campaignId } = req.body

  let adGroupService = user.getService('AdGroupService', 'v201609')
  let selector = {
    fields: ['Id', 'Name'],
    ordering: [{field: 'Name', sortOrder: 'ASCENDING'}],
    predicates: [{field: 'CampaignId', operator: 'EQUALS', values: [Number.parseInt(campaignId)]}],
    paging: {startIndex: 0, numberResults: AdwordsConstants.RECOMMENDED_PAGE_SIZE}
  }
  adGroupService.get({serviceSelector: selector}, (error, result) => {
    if (error) {
      return res.status(404).json(error)
    }
    return res.status(200).json(result)
  })
}

Getting this error:

"Unmarshalling Error: cvc-complex-type.2.4.d: Invalid content was found starting with element 'predicates'. No child element is expected at this point."

Anyone knows how to add predicates to selectors? I have tried using variations in the key: predicate/predicates and assigning array and non array values.

Any help is really appreciated.

Refresh token

Does the refresh token always have to be refreshed before it expires?

I am trying to refresh a token where the expiry_date has passed like so

console.log({ refreshToken });
auth.refreshAccessToken(refreshToken, (error, newTokens) => {
  if (error) {
    console.log(error);
  } else {
    console.log(newTokens);
  }
});

but get this error

{ refreshToken: '1/RXdGaAPOwhcye1-DNbZJYlz67ArETtPYBRnexxxxxxx' }
Exception while invoking method 'xxx' Error: No refresh token is set.
at OAuth2Client.refreshAccessToken (/xxx/node_modules/google-auth-library/lib/auth/oauth2client.js:199:14)
at AdwordsAuth.refreshAccessToken (/xxx/node_modules/node-adwords/adwords/auth.js:52:27)

The refreshToken is being passed, not sure why it says that it is not being set. I don't get this issue if I call this method before it expiry_date.

TrafficEstimatorService criteria problem

Given the below selector:

{
          selector: {
            campaignEstimateRequests: [
              {
                adGroupEstimateRequests: [
                  {
                    keywordEstimateRequests: [
                      {
                        keyword: {
                          text: 'mars cruise',
                          matchType: 'BROAD'
                        }
                      },
                      {
                        keyword: {
                          text: 'cheap cruise',
                          matchType: 'BROAD'
                        }
                      }
                    ],
                    maxCpc: {
                      microAmount: 1000000
                    }
                  }
                ],
                criteria: [
                  {
                    'xsi:type': 'cm:Language',
                    id: 1000
                  },
                  {
                    'xsi:type': 'cm:Location',
                    id: 2840
                  }
                ]
              }
            ],
            platformEstimateRequested: true
          }
        }

Notice the cm: prefix in the xsi:type of criteria, this is necessary because the namespace is different. If this is removed the request fails with the following error:

soap:Client: Unmarshalling Error: cvc-elt.4.2: Cannot resolve 'Language' to a type definition for element 'criteria'.

I found the problem by observing the namespaces that were being sent. I think the library should be able to figure out the namespace automatically, thoughts?

Uploading Image for a Display Ad

I'm attempting to upload an image to use as a display ad. Below is my function, which when called returns an error with message "soap:Client: [MediaError.UNSUPPORTED_TYPE @ media[0]]". I believe the structure I am using for media and operations is incorrect, but I am not sure what to use. I have tried many things and the docs haven't been very helpful. Any help is appreciated.

const mediaService = user.getService('MediaService');

const uploadImage = async (url) => {
  return new Promise((resolve, reject) => {
    const media = {
      type: 'IMAGE',
      urls: {
        key: 'FULL',
        value: url
      }
    };

    const operations = {
      media
    };

    mediaService.upload(operations, (err, result) => {
      if (err) {
        console.error(err);
        reject(err);
      }
      resolve(result.value);
    });
  });
};

Link to docs that identify IMAGE as an acceptable value of type: https://developers.google.com/adwords/api/docs/reference/v201802/AdGroupAdService.Media

Pagination

Hello,

Congratulations for this great lib.

I'm having trouble to iterate thru the pages.

let campaignService = user.getService('CampaignService', 'v201710')

//create selector
let selector = {
    fields: ['Id', 'Name'],
    ordering: [{field: 'Name', sortOrder: 'ASCENDING'}],
    paging: {startIndex: 0, numberResults: 500}
}
campaignService.get({serviceSelector: selector}, (error, result) => {
    console.log(error, result);
})

Using this code, in case of I have more than 500 campaigns, How could I iterate to next page?

Thanks!

AddCampaing using BudgetService

I'm having difficulties implement a new campaign, following original libraries guidelines and trying o use your repo:
PHP AddCampaign
Python AddCampaign
API reference for budget service

I cannot resolve budgetService. mutate() following those examples. My code is the following:

let budgetService = user.getService('BudgetService', 'v201609')
let budget = {
      'name': 'Some other budget #d47da42a-b6ab-4486-8320-8acc0ab80f24',
      'amount': {
      	  'ComparableValue.Type':'Money',
          'microAmount': '10000'
      },
      'deliveryMethod': 'STANDARD'
}
let budget_operations = [{
  'operator': 'ADD',
  'operand': budget
}]
let result = budgetService.mutate(budget_operations);

In Python, mutate result is the following:

(BudgetReturnValue){
   ListReturnValue.Type = "BudgetReturnValue"
   value[] = 
      (Budget){
         budgetId = 979538539
         name = "Alternate budget #08f38976-d31f-4f1e-9f4d-018b4cfb72da"
         amount = 
            (Money){
               ComparableValue.Type = "Money"
               microAmount = 30000
            }
         deliveryMethod = "STANDARD"
         isExplicitlyShared = True
         status = "ENABLED"
      },
 }

Using this code returns an error:

result = budgetService.mutate(budget_operations);
RangeError: Maximum call stack size exceeded
    at String.substring (native)
    at splitQName (/Users/gabrielParrable/localDev/node-adwords-dev/node_modules/soap/lib/wsdl.js:64:19)
    at WSDL.findChildSchemaObject (/Users/gabrielParrable/localDev/node-adwords-dev/node_modules/soap/lib/wsdl.js:1937:20)
    at WSDL.findChildSchemaObject (/Users/gabrielParrable/localDev/node-adwords-dev/node_modules/soap/lib/wsdl.js:1945:19)
    at WSDL.findChildSchemaObject (/Users/gabrielParrable/localDev/node-adwords-dev/node_modules/soap/lib/wsdl.js:1945:19)
    at WSDL.findChildSchemaObject (/Users/gabrielParrable/localDev/node-adwords-dev/node_modules/soap/lib/wsdl.js:1945:19)
    at WSDL.findChildSchemaObject (/Users/gabrielParrable/localDev/node-adwords-dev/node_modules/soap/lib/wsdl.js:1945:19)
    at WSDL.findChildSchemaObject (/Users/gabrielParrable/localDev/node-adwords-dev/node_modules/soap/lib/wsdl.js:1945:19)
    at WSDL.findChildSchemaObject (/Users/gabrielParrable/localDev/node-adwords-dev/node_modules/soap/lib/wsdl.js:1945:19)
    at WSDL.findChildSchemaObject (/Users/gabrielParrable/localDev/node-adwords-dev/node_modules/soap/lib/wsdl.js:1945:19)

What am I missing?

AuthorizationError.SERVICE_ACCESS_DENIED

HI
I tried to get google adwords report with node-adwords, and arguments like developerToken,userAgent,clientCustomerId,client_id,client_secret,refresh_token are correct in my MCC account.
I am an administrator in MCC account and has a high-level credentials.
Howerev I still met the error AuthorizationError.SERVICE_ACCESS_DENIED.

I want to know why it is. Please help me out. Thanks.

v201806 CustomerService getCustomers returns unexpected XML error

Hello, I upgraded from v201710 to v201806 using version: 201806.0.1
When doing a request to retrieve the customers I receive:

"{"name":"externalError","message":"Text data outside of root node.\nLine: 0\nColumn: 90\nChar: l","statusCode":400}"

Request:

`let user = new AdwordsUser({
developerToken: adwordsDeveloperToken,
client_id: adwordsClientId,
client_secret: adwordsClientSecret,
access_token: accessToken
});

let customerService = user.getService('CustomerService', 'v201806');

let selector = {
fields: ['CustomerId', 'Name'],
ordering: [{field: 'CustomerId', sortOrder: 'ASCENDING'}],
paging: {startIndex: 0, numberResults: AdwordsConstants.RECOMMENDED_PAGE_SIZE}
};

return new Promise( (resolve, reject) => {
customerService.getCustomers({serviceSelector: selector}, (error, result) => {
if (error) {
reject(error);
}
resolve({data: result});
})
})`

Then I downgraded to 201802.3.0, this version does work as expected.

What could be the issue?

Thanks,

Patrick

ConstantDataService does not work

I tried to get list of existing languages with ConstantDataService but got nothing. It doesn't return error nor result. What am I doing wrong?
`const AdwordsUser = require('node-adwords').AdwordsUser
const adwordsApiUser = new AdwordsUser(config.get('services.adwords.user')) //correct user data
const constantDataService = adwordsApiUser.getService('ConstantDataService', config.get('services.adwords.version'))

constantDataService.getLanguageCriterion((err, result) => console.log(err, result)`

AdCustomizerFeedService nagging about selectors

Hi I am getting stuff to work but the selectors for the feed is not working. It just responds:
body: '<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><soap:Fault><faultcode>soap:Client</faultcode><faultstring>Unmarshalling Error: cvc-complex-type.2.4.a: Invalid content was found starting with element \'feedname\'. One of \'{"https://adwords.google.com/api/adwords/cm/v201609":feedId, "https://adwords.google.com/api/adwords/cm/v201609":feedName, "https://adwords.google.com/api/adwords/cm/v201609":feedStatus, "https://adwords.google.com/api/adwords/cm/v201609":feedAttributes}\' is expected. </faultstring></soap:Fault></soap:Body></soap:Envelope>' },

function createCustomizerFeed(feedName) {
	var adCustomizerFeedService = AdWordUser.getService('AdCustomizerFeedService', 'v201609');
	let nameAttr = {
		name: "NameTest"
	}
	let Feed = {
		feedname: "TestName",
		feedattributes: [nameAttr]
	}
	let FeedOperation = {
		operand: Feed,
		operator: "ADD"
	}
	adCustomizerFeedService.mutate({ operations: [FeedOperation] }, (error) => {
		if (error) {
			console.log(error);
		} else {
			console.log("feed created!");
		}
	});
}

Am I missing something ? I looked at the following link for creating the feed

https://github.com/googleads/googleads-php-lib/blob/master/examples/AdWords/v201609/AdvancedOperations/AddAdCustomizer.php

TypeError: uuid.v4 is not a function

Hello there!
Thanks for sharing the library :)

I'm trying to fetch an accounts list from my customers, but I'm receiving this error upon every request to the Adwords API:

.../node_modules/soap/lib/client.js:275
  var eid = options.exchangeId || uuid.v4();
                                       ^

TypeError: uuid.v4 is not a function

Do you have any idea of how can I solve this? Tried changing my uuid version on my packages.json but didn't do the trick, still getting it.

Out of order elements causes error

Having elements outside of the normal adwords order causes issues with the sdk / api.

Test Case

//this will work
let operation = {
    operator: 'ADD',
    operand: {
     ....
    }
}
//this will not work
let operation = {
    operand: {
     ....
    },
    operator: 'ADD',
}

We might need to read the wsdl to determine the order of elements or something. Not really sure how to solve this one as dynamically as possible.

For now, having the elements in the correct order is the workaround.

Publish release?

Hi there,

First off, thanks for the great work on this. I'd appreciate it if you could publish a new release containing 506f638 to npm, as we're looking to run some reports using the new date range functionality.

Installing from master for now, but an npm release would be great.

TargetingIdeaService error

I have been trying to get this code to work but i have no idea why its still not working, could you please help me out?

var TargetingIdeaService = user.getService('TargetingIdeaService', 'v201609')

//create selector
var selector={
SearchParameter:[{RelatedToQuerySearchParameter:'Games'}],
IdeaType:'KEYWORDS',
requestType:'IDEAS',
requestedAttributeTypes: ['TARGETED_MONTHLY_SEAsRCHES', 'KEYWORD_TEXT'],
paging: {startIndex: 0, numberResults:20}
}

TargetingIdeaService.get({serviceSelector: selector}, function (error, result) {
console.log(error, result);
})

Adding a BlockIP entry

Kudos for a good library. I'm trying to create a block IP criterion for a campaign and it's failing with the following error:

"Fault": { "faultcode": "soap:Client", "faultstring": "Unexpected wrapper element mutate found. Expected {https://adwords.google.com/api/adwords/cm/v201609}mutate." }

I'm following the PHP library as advised and as a matter of fact have a working implementation of the same functionality in PHP with the one difference - in PHP I'm instantiating a NegativeCampaignCriterion which I'm not able to do here since the lib is using a standard object notation. This is why this looks like an issue with the library itself.

These are the methods/entities used:

Here's my implementation:

blockIp(accountNumber,campaignId,ip) {
    var _this = this;

    return _this.configure().then(function onApiConfigured() {
      // prepare
      var user = _this.prepareUser(accountNumber);
      var service = user.getService('CampaignCriterionService', _this.gapi.version);

      // build
      var criterion = {
        campaignId: campaignId,
        isNegative: true,
        criterion: { ipAddress: ip }
      };
      var operation = { operator: 'ADD', operand: criterion };

      // wrap the call in a promise
      return new Promise(function executeBlockIp(resolve,reject) {
        service.mutate([operation], function onBlockIpDone(err, result) {
          if(err) {
            reject({ message: 'Google API error', error: err });
          }
          else {
            resolve(result);
          }
        });
      });
    });
  }

Please note that _this.prepareUser(accountNumber); is working in other functionality implementations so there are no hidden problems, just the fact I seem to be failing at implementing this operation.

Can you advise? Needless to say I will appreciate a quick reply and assistance.

using OfflineConversionFeedService

hi brother thanks for the package. any chance you are attaching a small example of how to use
this service ? i have looked at the php api example like here but couldn't get it to work.
$offlineConversionService = $user->GetService("OfflineConversionFeedService", API_VERSION);
$operations = array();
foreach ($conversions as $conversion) {
$gclid = $conversion["gclid"];
$convDate = date("Ymd His", $conversion["date"]);
$convValue = isset($conversion["value"]) ? $conversion["value"] : 0;
$offlineConversion = new OfflineConversionFeed(
$gclid, $conversionName, $convDate, $convValue
);
$operations[] = new OfflineConversionFeedOperation($offlineConversion, "ADD");
}
$result = $offlineConversionService->mutate($operations);

thank you very much

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.