obtain parameters through gclid

592 views
Skip to first unread message

Aitor Udabe

unread,
Jul 6, 2016, 7:23:56 AM7/6/16
to AdWords Scripts Forum
Hello good afternoon,
I have a general question , I GCLID through , I get the keyword entered by the user in google for that ad active?

And another question is , I can get through the gclid parameters you have entered on the form ?

regards

Tyler Sidell (AdWords Scripts Team)

unread,
Jul 6, 2016, 10:56:58 AM7/6/16
to AdWords Scripts Forum
Hi,

You can run a Click Performance Report and request GclId, AdGroupId, and CriteriaId. The CriteriaId corresponds to the keyword id, so you can then select the desired keyword.

This report gives you data one date a time and you can only go back 90 days.

Thanks,
Tyler Sidell
AdWords Scripts Team
Message has been deleted

Aitor Udabe

unread,
Jul 8, 2016, 3:39:46 AM7/8/16
to AdWords Scripts Forum
Hi Tyler,
Thanks for answering.

Now my question that arises is how can I know if I have done these users report yesterday were no conversions or not. ?

Another question is that gclid have read that data can get names etc fill in the contact form my landing . This is possible? I can show you an example of how to do it to take the sheet and save the data there ?

Thank you

Tyler Sidell (AdWords Scripts Team)

unread,
Jul 8, 2016, 4:34:11 PM7/8/16
to AdWords Scripts Forum
Hi Aitor,

Answering the first question pertaining to knowing if the reports generated yesterday have 0 conversions, you can use the Conversions field.  Then, you can take that field and filter your report query stating to only show entities that have more than zero conversions.
'WHERE Conversions > 0 '

As for your second question, I am not exactly following what you are trying to achieve with the gclid.  Can you please provide more details and a sample example if you have one?

Thanks,
Tyler Sidell
AdWords Scripts Team

Message has been deleted

Aitor Udabe

unread,
Jul 11, 2016, 12:09:20 PM7/11/16
to AdWords Scripts Forum
Thank you Tyler.

What I'm trying to develop is to create a script for google adwords, which will have to function :

1- Collect user data by completing the contact form on the landing page you are visiting .

2- Provide us that landing visiting the user whether or not to fill out the form , the ad group , the campaign to which it belongs and keyword entered by the user (if you can) but serious keyword why it has triggered the ad and whether or not there has been conversion .

3- this pass it to a google sheet .


Not if I have now explained well , but let me know . So far I have this code: which includes the gclid me the landing page, ad group , campaign, date and keyword why is activated. but I need to point 1 , it is to collect user data if you complete the contact form and whether or not there have been conversions .
This is my CODE:
var GOOGLE_DOC_URL = "https://docs.google.com/spreadsheets/d/1wlTyFTlMfhBBHfo3RtN9IWW6_8NqL9bDFYU71ZdVCyA/edit#gid=0";

function main() {
       
  clicks
= runCampaignReport();
  modifySpreadSheet
(clicks);
 
}
function runCampaignReport() {

   
var listOfClicks = [];
 
       
var report = AdWordsApp.report(
     
'SELECT Date, GclId, ClickType, Page, Slot, AdFormat, CityCriteriaId, RegionCriteriaId, CountryCriteriaId, CriteriaParameters ' +
     
'FROM   CLICK_PERFORMANCE_REPORT ' +
     
'DURING YESTERDAY');
   
     
var rows = report.rows();

         
while (rows.hasNext()) {
                   
var row = rows.next();
       
           
var date = row['Date'];  
                   
var gclid = row['GclId'];
           
var clickType = row['ClickType'];
                   
var page = row['Page'];
                   
var slot = row['Slot'];
                   
var criteria = row['CriteriaParameters'];
                   
var adFormat = row['AdFormat'];
                   
var city = row['CityCriteriaId'];
           
var state = row['RegionCriteriaId'];
           
var country = row['CountryCriteriaId'];
                   
var userList = row['UserListId']
                   
           
var clickResult = new clickData(date, gclid, clickType, page, slot, criteria, adFormat, city, state, country, userList);
       
           listOfClicks
.push(clickResult);
           
         
}  // end of report run
   
         
return listOfClicks;
     
}

function clickData(date, gclid, clickType, page, slot, criteria, adFormat, city, state, country, userList) {
       
this.date = date;
       
this.gclid = gclid;
 
this.clickType = clickType;
       
this.page = page;
       
this.slot = slot;
       
this.criteria = criteria;
       
this.adFormat = adFormat;
       
this.city = city;
   
this.state = state;
   
this.country = country;
       
this.userList = userList;
       
}

function modifySpreadSheet(results) {
 
 
var gclidResults = results;
 
 
var gclidSS = SpreadsheetApp.openByUrl(GOOGLE_DOC_URL);
 
 
var sheet = gclidSS.getActiveSheet();
 
 
var columnNames = ["Date", "Gclid", "Criteria", "ClickType", "Page", "Slot", "AdFormat","City", "State", "Country","UserList"];
 
 
var headersRange = sheet.getRange(1, 1, 1, columnNames.length);
         
   
for (i = 0; i < gclidResults.length; i++) {
        headersRange
.setValues([columnNames]);
                     
var date = gclidResults[i].date;
                     
var gclid = gclidResults[i].gclid;
                     
var criteria = " " + gclidResults[i].criteria;
                     
var clickType = gclidResults[i].clickType;
                     
var page  = gclidResults[i].page;
                     
var slot = gclidResults[i].slot;
                     
var adFormat = gclidResults[i].adFormat;
                     
var city = gclidResults[i].city;
                     
var state = gclidResults[i].state;
                     
var country = gclidResults[i].country;
           
      sheet
.appendRow([date, gclid, criteria, clickType, page, slot, adFormat, city, state, country]);
   
}  
}



Tyler Sidell (AdWords Scripts Team)

unread,
Jul 11, 2016, 5:14:25 PM7/11/16
to AdWords Scripts Forum
Hi Aitor,

Thanks for clarifying your use case.  However, collecting data from a contact form would not be possible through AdWords Scripts.  You might be able to capture this information from App Scripts.  Would you mind asking your question to App Scripts as well? 

Regards,
Tyler Sidell
AdWords Scripts Team

Aitor Udabe

unread,
Jul 12, 2016, 3:33:21 AM7/12/16
to AdWords Scripts Forum
Hi Tyler, I do not speak English very well , I have not understood what I wanted to say , I mean that script through adwords can not collect user data through the gclid and a cookie ? if that can not I find the data I get from gclid with repor know how I can know what visits have become?

Tyler Sidell (AdWords Scripts Team)

unread,
Jul 12, 2016, 10:24:50 AM7/12/16
to AdWords Scripts Forum
Hi Aitor,

If I understand correctly you're trying to get information from each click.  The only fields that would be available are the ones in a Click Performance Report.

Thanks,
Tyler Sidell
AdWords Scripts Team

Aitor Udabe

unread,
Jul 12, 2016, 10:29:36 AM7/12/16
to AdWords Scripts Forum
Okay that's what I'm doing now , but my boss asks me if this information can not be filtered by conversion ?

Then i was reading through gclid that I can get the data you entered on the form with a cookie.

Do not know if this is true or not ?

Tyler Sidell (AdWords Scripts Team)

unread,
Jul 12, 2016, 4:42:34 PM7/12/16
to AdWords Scripts Forum
Hi Aitor,

I can confirm that information obtained from a form is not available through AdWords Scripts.

Thanks,
Tyler Sidell
AdWords Scripts Team

Aitor Udabe

unread,
Jul 13, 2016, 3:35:43 AM7/13/16
to AdWords Scripts Forum

Ok perfect for that topic I'll look to perform with some cookie through the gclid . The other issue to obtain conversions with the pass code you can not know the conversions that have been made in yesterday ?

Tyler Sidell (AdWords Scripts Team)

unread,
Jul 13, 2016, 5:00:26 PM7/13/16
to AdWords Scripts Forum
Hi Aitor,

If you are looking to get conversions from yesterday you could set up something similar to the following:
function main() {
 
var campaign = AdWordsApp.campaigns().get();
 
 
while (campaign.hasNext()) {
   
var currentCamp  = campaign.next();
   
var conversions = currentCamp.getStatsFor('YESTERDAY').getConversions();
   
Logger.log("Conversions for " + currentCamp.getName() + ": " + conversions);
 
}
}

These are the available preset date ranges available.

Thanks,
Tyler Sidell
AdWords Scripts Team

Aitor Udabe

unread,
Jul 14, 2016, 3:43:03 AM7/14/16
to AdWords Scripts Forum

But this code does not get me gclid neither the date nor the country or city truth or keyword or anything right?
<br style="color:rgb(0,0,0);font-family:Arial,sans-ser

Tyler Sidell (AdWords Scripts Team)

unread,
Jul 14, 2016, 4:25:50 PM7/14/16
to AdWords Scripts Forum
Hi Aitor,

As the requirements for your use case keep changing, you may want to check out the available fields that we have in reports and select the report that works best for you. GclId is only available for a Click Performance Report, which unfortunately does not have conversions as an available field. Not all fields are available in all reports.

Thanks,
Tyler Sidell
AdWords Scripts Team

Message has been deleted

Aitor Udabe

unread,
Jul 20, 2016, 5:30:12 AM7/20/16
to AdWords Scripts Forum
Hello again,

Well let you know that I could do what I was looking for , I mean to get data from the contact form through php.

Now what I need is I want to make a report conversions the last 7 days, where in the report , date, keyword, city user , the name of the campaign, the ad URL , display the gclid Yes you can.

These are the data that I would like to get the report of all converiones the last 7 days, not how to make the report with adwords script

Tyler Sidell (AdWords Scripts Team)

unread,
Jul 20, 2016, 2:08:01 PM7/20/16
to AdWords Scripts Forum
Hi Aitor,

This forum is for AdWords Scripts related questions.  In your last comment, you stated that you would not like to use AdWords Scripts in order to accomplish this task.  We can only assist with questions pertaining to this product.  Please note that Scripts is Javascript based, and thus you won't be able to use PHP in our interface.  I've provided instructions on how to grab this information from AdWords Scripts in the previous thread.  Please feel free to each out with any specific questions pertaining to this product.

Thanks,
Tyler Sidell
AdWords Scripts Team

Aitor Udabe

unread,
Jul 22, 2016, 3:57:23 AM7/22/16
to AdWords Scripts Forum

Thanks tyler, but my question now if this script related adwords, since I want to make a report of conversions in the last 7 days, the report conversions you can get the url gclid or visited ?
<pre dir="ltr" style="padding-right:0.14em;border-width:initial;border-style:none;overflow:hidden;width:281.5px;word-wrap:b

Tyler Sidell (AdWords Scripts Team)

unread,
Jul 22, 2016, 4:47:02 PM7/22/16
to AdWords Scripts Forum
Hi Aitor,

As stated originally, you can run a Click Performance Report and request GclId, AdGroupId, and CriteriaId.   If you are using a Click Performance Report, you would not be able to pull in conversions.  You would have to use a separate spreadsheet for that and combine the stats of the two.  Below is an example of using the Click Performance Report, exporting it to a spreadsheet, and emailing the sheet to yourself.  You can use the same model for a report that pulls conversions.   Please note that the click performance report can only be used for a single date range so you would need to pull the stats each day.  

function main() {
 
var spreadsheetUrl = 'CHANGE_TO_YOUR_SPREADSHEET_URL';
 
var email = 'CHANGE_TO_YOUR_EMAIL_ADDRESS'
 
var spreadsheet = SpreadsheetApp.openByUrl(spreadsheetUrl);
 
var sheet = spreadsheet.getActiveSheet();
 
var report = AdWordsApp.report("SELECT GclId, AdGroupId, CampaignId FROM CLICK_PERFORMANCE_REPORT DURING YESTERDAY");
 
  report
.exportToSheet(sheet);
 
 
MailApp.sendEmail(email, "Click Performance Report", "Report can be found here " + spreadsheetUrl);  
}

Thanks,
Tyler Sidell
AdWords Scripts Team

Aitor Udabe

unread,
Jul 25, 2016, 3:36:02 AM7/25/16
to AdWords Scripts Forum

Hello tyler, thanks again, I have some doubts and feel be heavy but my English is not very good . 1- to know conversions 7 days ago the only way conversion reporting is not it? With this report, I can tell you visited url , city , campaign, ad and keyword ? 2- Click Performance Report to know that I know gclid , city, Paius , keyword , url you visited , date, but I can not find true conversions ? There is no way to filter users who have become?

         
   
for (i = 0; i < gclidResults.length; i<span style="

Aitor Udabe

unread,
Jul 26, 2016, 9:42:04 AM7/26/16
to AdWords Scripts Forum

Hi Tyler, in this thread mentioned that the performance report click conversion may leak , right? You could give me an example and not how to do it ?

Anash Oommen

unread,
Jul 26, 2016, 10:44:21 AM7/26/16
to AdWords Scripts Forum
Hi Altor,

This thread seems a bit confusing right now, so I'll try to answer the original questions you asked when you opened this thread:

(1) If you run click performance report, you will get Date, GclId, ClickType, Page, Slot, AdFormat, CityCriteriaId, RegionCriteriaId, CountryCriteriaId, CriteriaId, etc. It won't give you Conversions. 
(2) This topic isn't related to AdWords Scripts, but if you look at https://support.google.com/adwords/answer/3285060 (Step 2), it shows how to set gClid as a cookie.

So one way of tracking the whole flow would be
(a) On the signup page, you can obtain the gclid using (2). Save this information in your database along with the signup (I assume a signup is the measure of your conversion)
(b) Run Click performance report. It gives you gClid, CampaignId, AdGroupId, CriteriaId. Join this data with the gClid data to get the conversions data.

Hope this helps. Let me know if you have more questions, or if i got my assumptions wrong.

Cheers,
Anash P. Oommen,
AdWords Scripts Team

Aitor Udabe

unread,
Jul 27, 2016, 10:47:12 AM7/27/16
to AdWords Scripts Forum
Hello Anash ,

Thanks for answering.

I explain a little , the issue of gclid I have resolved and get the user settings using php and keep in a sheet . then the subject closed.

What I want to know how to do now with adwords script is:

1- How do I know conversions have my landing page in the last 7 days, and wanted to know if I know the conversions gclid , country , city, keywords, and landing page or ad that I click ?

If not possible Tyler I commented that by the click perfomance report , could then filter by conversion > 0 .

That's possible?

Why I want to do this to keep track of users who have contacted me without I go one on one every day putting them on the sheet .

         
   
for (i = </

Anash Oommen

unread,
Jul 29, 2016, 5:36:20 PM7/29/16
to AdWords Scripts Forum
Hi Aitor,

1) You cannot get conversions associated with the gclid through AdWords API or Scripts. The simple reason is that Click Performance report is the only report with gclid, and that report doesn't expose Conversions. If you have a way of tracking your conversions by page locally, then you can join the click performance data with your local logs and figure out this value. I can't think of any other approach unfortunately.

2) Since Conversions is not a column on Click Performance report, so filtering on that column won't work. 

As far as I can tell, there's no way to do this purely using AdWords data alone. Though, there might be an approach that I am not familiar with. Could you kindly ask this question on the product forum (https://www.en.advertisercommunity.com/#)? If you find an answer over there, feel free to post it here, and I'll help you do the equivalent in Scripts.

Cheers,
Anash P. Oommen,
AdWords Scripts Team.
Message has been deleted

Aitor Udabe

unread,
Aug 1, 2016, 6:07:06 AM8/1/16
to AdWords Scripts Forum

Hi Anash . With the conversion report I can get the following fields , visited url , country , city , date, and keyword used ?

Aitor Udabe

unread,
Aug 3, 2016, 5:37:33 AM8/3/16
to AdWords Scripts Forum
Hi Anash con i help me please

Anash Oommen

unread,
Aug 4, 2016, 1:01:06 PM8/4/16
to AdWords Scripts Forum
Hi Altor,

Apologies for the delay. You can use the Geo performance report to get these details, see https://developers.google.com/adwords/api/docs/appendix/reports/geo-performance-report.

Scripts support many more reports, but unfortunately it doesn't give a way to join reports by gClid. That column is available only in Click performance report.

Cheers,
Anash 
function modifySpreadSheet<span style="color:#660"
Reply all
Reply to author
Forward
0 new messages