Hello;

We are trying to find out how to track keywords associated with our mobile 
searches. Third party companies such as CallRail and CallTrackingMetrics 
have built Google Adwords Mobile Click to Call integrations which "match 
calls with clicks" in an effort to report the keywords associated with 
calls in call-only ads and mobile campaigns that have mobile only call 
extensions.

Here is the information from CallRail re: what we are trying to build
https://support.callrail.com/hc/en-us/articles/205850416-AdWords-Mobile-Click-to-Call-Integration

Here is an example script being used by CallTrackingMetrics to Pull in 
Keyword data from call only ads. *I can verify that the below code is not 
100% accurate as the keywords being returned are not in alignment with what 
I see in AdWords.

/* Copyright 2016 CallTrackingMetrics LLC */ function 
filterByCallType(e,a,t){"Mobile click-to-call"==a?e.Device.
match(/Mobile|Tablet/)&&t():t()}function criteriaReport(e,a,t,r,l){for(var 
o=[],i=r.within.start.slice(0,8),C=r.within.end.slice(0,8),n="DURING 
"+i+","+C,d="SELECT Id, Device, Criteria, CriteriaType, Clicks, 
Impressions, CampaignName, CampaignId, AdGroupName, AdGroupId, 
AdNetworkType2, ClickType, Slot, QualityScore FROM 
CRITERIA_PERFORMANCE_REPORT where ClickType=CALLS AND Clicks > 0 AND 
AdGroupId='"+e+"' "+n,c=AdWordsApp.report(d),p=c.rows();p.hasNext();){var 
g=p.next();filterByCallType(g,t,function(){g.CallType=t,
Logger.log("captured("+r.id+") of type: "+t),o.push(g)})}return 
o.length||o.push({KeywordId:l.Id,CampaignName:l.CampaignName,CampaignId:l.
CampaignId,AdGroupName:l.AdGroupName,AdGroupId:l.AdGroupId,CallType:t}),o}function
 
ctmFetch(e,a,t){var r={contentType:"application/
json",headers:{Authorization:"Basic "+Utilities.base64Encode(
CTMKEY+":"+CTMSEC)},method:a};t&&(r.payload=t);var 
l=UrlFetchApp.fetch(CTMHOST+"/api/v1/accounts/"+CTMACT+"/calls/"+e,r),o=l.getContentText();return
 
Utilities.jsonParse(o)}function fetchCallData(){var 
e=AdWordsApp.currentAccount().getTimeZone(),a=ctmFetch("ad_
extensions?tz="+e).calls;Logger.log("running analysis for : "+a.length+" 
calls");for(var t=0,r=a.length;r>t;++t){Logger.log("fetch for "+t+" < 
"+r);try{var l=a[t],o=lookupDataForCall(l);o.length?(Logger.log(" Criteria 
Id CriteriaType Clicks Impressions CampaignName AdGroupName ClickType 
Criteria"),Logger.log("trigger data for "+t),Logger.log(" Send data for: "+
l.id+" matched: "+o.length),ctmFetch("possible_keywords?id="+l.id,"
post",JSON.stringify({captured:o})),Logger.log("still 
active?")):Logger.log("no adwords calls detected for: "+l.id
)}catch(i){Logger.log(i)}}Logger.log("exit loop for "+t)}function 
lookupDataForCall(e){var a={972:!0,33:!0},t=e.areaCode;
a[e.countryCode]&&!t.match(/^0/)&&(t="0"+t);var r="SELECT AdGroupId, 
AdGroupName, CampaignId, CampaignName, CallStartTime, CallEndTime, 
CallerCountryCallingCode, CallerNationalDesignatedCode, CallType, 
CallStatus, CustomerDescriptiveName FROM CALL_METRICS_CALL_DETAILS_REPORT 
WHERE CallerCountryCallingCode='"+e.countryCode+"' AND 
CallerNationalDesignatedCode='"+t+"' AND CallStartTime >= 
'"+e.within.start+"' AND CallStartTime <= '"+e.within.end+"'";Logger.log("Query 
for "+e.id+" with "+r);for(var 
l=AdWordsApp.report(r),o=l.rows(),i=[];o.hasNext();){var 
C=o.next();if(Logger.log("Phone Call:"+C.AdGroupName+" "+C.CallStartTime+" 
"+C.CallEndTime+" "+C.CallerCountryCallingCode+" 
"+C.CallerNationalDesignatedCode+" 
"+C.CallType+" "+C.CallStatus+" "+C.CustomerDescriptiveName),
i=criteriaReport(C.AdGroupId,C.CallStartTime,C.CallType,e,C))return 
i}return i}function main(){fetchCallData()}var CTMHOST="
https://api.calltrackingmetrics.com",CTMACT=103975,CTMKEY=";
a103975d0a444cea7323b01b45e40216b5c0dda7",CTMSEC="
a38881d623f53aefafdb13a079621c05b941";



Can anyone help me understand how to pull in keyword data based on calls 
coming from call only ads? These ads use phone numbers provisioned by 
Twilio. We are currently tracking start time / end time / call duration / 
caller_id / geo based on NPA-NXX data /etc.


-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and Google+:
https://googleadsdeveloper.blogspot.com/
https://plus.google.com/+GoogleAdsDevelopers/posts
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords API Forum" group.
To post to this group, send email to adwords-api@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"AdWords API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to adwords-api+unsubscr...@googlegroups.com.
Visit this group at https://groups.google.com/group/adwords-api.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/ad6e6483-f898-4250-bac3-bf10042198e0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
  • How to Find Key... Brian C
    • Re: How to... 'Shwetha Vastrad (AdWords API Team)' via AdWords API Forum

Reply via email to