Api Google Adwords

Consultez la formation au référencement naturel Google de WebRankInfo / Ranking Metrics

bolbo
WRInaute discret
WRInaute discret
 
Messages: 68
Inscription: Jeu Avr 29, 2004 9:04

Api Google Adwords

Message le Mar Jan 03, 2006 11:13

Bonjour,

J'ai commencé à tester l'API Google Adwords, mais j'ai des problèmes pour obtenir des résultats, à partir des sample code en PHP fournis par GG.

J'en utilise deux, l'estimation de trafic et le keyword_report.
Pourle traffic ca marche très légèrement, mais le keyword report pas du tout.
Code: Tout sélectionner
<?

// Copyright 2005, Google Inc. All rights reserved.

require_once('nusoap.php');

/*
* This sample program illustrates how to get traffic estimates for keywords.
* This program uses nusoap.php to handle the SOAP interactions.
*/

// Set up the authentication headers
$email = "<email>Mail</email>";
$password = "<password>Password</password>";
$userAgent = "<useragent>UserAgent</useragent>";
$token = "<token>Token</token>";
$header = $email . $password . $userAgent . $token;

// Connect to the WSDL for the TrafficEstimatorService
$wsdl="https://adwords.google.com/api/adwords/v2/TrafficEstimatorService?wsdl";
$client=new soapclient($wsdl, 'wsdl');

// Set the headers; they are needed for authentication
$client->setHeaders($header);

// With nusoap, you need to include XML with the parameters
$keyword0 = "<text>Mot1</text>";
$keyword1 = "<text>Mot2</text>";
$otherinfo = "<maxCpc>500000</maxCpc><type>Broad</type>";

// Need to keep track of the order that we send in the keywords
// so we can match them to the results
$keywordTextArray[0] = "Mot1";
$keywordTextArray[1] = "Mot2";

$otherinfo = "<maxCpc>500000</maxCpc><type>Broad</type>";
$keywordxml = "<KeywordRequest> $keyword0 $otherinfo </KeywordRequest><KeywordRequest> $keyword1 $otherinfo</KeywordRequest>";

// Construct the XML string for the parameters
// It's a nusoap thing that the param string needs to include the operation name too
// Specifying the namespace is optional, AdWords API web services can use the default namespace
// $param="<estimateKeywordList xmlns='https://adwords.google.com/api/adwords/v2'>" . $keywordxml . "</estimateKeywordList>";
$param="<estimateKeywordList>" . $keywordxml . "</estimateKeywordList>";

// Make the request to estimate the ikeywords
$response= $client->call("estimateKeywordList", $param);

// If the headers hadn't been set already, you'd need to provide them in the call to call()
//$response = $client->call("estimateNewAdGroup", $param, false, false, $header);

/* handle any SOAP faults. */
if ($client->fault) {
echo "<P>FAULT: {$client->fault}";
echo "<P>Code: {$client->faultcode}";
echo "<P>String: {$client->faultstring}";
echo "<P>Detail: {$client->faultdetail}";
return;
}

// If we got this far, $response contains the estimates
$count = count($response);
echo "<P>There are " . $count . " elements in the response array.";

// A single response is returned as an array of field values.
// Multiple responses are returned as an array of arrays.

if (is_array($response[0]))
{
echo "<P>We have an array of responses, need to iterate over them";
$i = 0;

while ($i < $count)
{
// Need to get the keyword text out of $keywordTextArray
// because the keywordEstimate doesn't know the keyword text
echo "<!-- keyword --><H3>" . $keywordTextArray[$i] . "</H3>";
printResults($response[$i]);
$i++;
}
}

else // only a single response
{
// echo "<H3>ONE RESPONSE</H3>";
echo "<!-- keyword text--><H3>" . $thiskeyword . "</H3>";
printResults($response);
}

function printResults ($estimate) {
echo "<blockquote>cpc " . $estimate['cpc'];
echo "<br>clicks " . $estimate['ctr'] * $estimate['impressions'];
echo "<br>ctr " . $estimate['ctr'];
echo "<br>impressions " . $estimate['impressions'];
echo "<br>notShown " . $estimate['notShownPerDay'];
echo "<br>position " . $estimate['avgPosition'];
echo "</blockquote>";
}
?>




Edit AW, il est interdit de donner ses resultats

Mais pas de clics ni d'impression ni rien.

J'aimerais savoir si quelqu'un a déjà utilisé cette API, et s'il est possible de faire comme dans le centre multicompte de Adwords, à savoir créer un générateur de mots clés avec des expressions connexes (rubrique "Générateur de mots clés" dans la gestion des campagnes).


Merci d'avance pour vos réponses,

Bolbo

Lukas
Nouveau WRInaute
 
Messages: 4
Inscription: Mer Avr 08, 2009 10:22

Re: Api Google Adwords

Message le Mer Avr 08, 2009 12:45

Bonjour bolbo,
le message date mais bon... je suis en train de m'y mettre aussi (api adwords) as tu trouvé la solution à ton problème ?


Formation recommandée sur ce thème :

Formation Référencement naturel Google : apprenez une méthode efficace pour optimiser à fond le référencement naturel dans Google de façon durable... Formation animée par Olivier Duffez et Fabien Facériès, experts en référencement naturel.

Tous les détails sur le site Ranking Metrics : programme, prix, dates et lieux, inscription en ligne.

Lectures recommandées sur ce thème :



Qui est en ligne

Utilisateurs parcourant ce forum: Aucun utilisateur enregistré et 0 invités