Sha256: 1a77526211ca4c947d87662ee535865825d298d76dc8da3cdd4962707319668c

Contents?: true

Size: 771 Bytes

Versions: 3

Compression:

Stored size: 771 Bytes

Contents

#!/usr/bin/env ruby

# Use adwords4r in parent dir
$LOAD_PATH.unshift '../lib/'

require 'adwords4r'

def printkw(kw, gname)
    puts "#{gname} #{kw.advertiserCompetitionScale} #{kw.searchVolumeScale} #{kw.text}"    
end

begin
    if (ARGV.length < 1)
        puts "Usage: #$0 <url>" 
        exit
    end
    adwords = AdWords::API.new
    result = adwords.getKeywordsFromSite(ARGV[0], true, [], [])
    groups = result.getKeywordsFromSiteReturn.groups
    kws = result.getKeywordsFromSiteReturn.keywords
    puts "GroupName AdvertiserCompetitionScale searchVolumeScale text"
    kws.each {|kw| printkw(kw, groups[kw.groupId.to_i])}    

rescue AdWords::Error::UnknownAPICall => e
    puts e
rescue AdWords::Error::ApiError => e
    puts e.code
    puts e.message
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
adwords4r-11.1.0 examples/old/keyword_tool_demo.rb
adwords4r-11.0.2 examples/keyword_tool_demo.rb
adwords4r-11.0.3 examples/keyword_tool_demo.rb