marshmallow/adwords-targeting-idea-service

Laravel 对 AdWords Targeting Idea Service 的包装

v1.1.0 2023-01-17 08:05 UTC

README

Latest Version Software License Build Status Quality Score StyleCI Latest Version on Packagist Total Downloads

安装

此软件包可以通过 Composer 安装。

$ composer require schulzefelix/laravel-adwords-targeting-idea-service

该软件包将自动注册服务提供者。如果禁用了包发现,请添加以下内容。

// config/app.php
'providers' => [
    ...
    SchulzeFelix\AdWords\AdWordsServiceProvider::class,
    ...
];

该软件包将自动注册外观。如果禁用了包发现,请添加以下内容。

// config/app.php
'aliases' => [
    ...
    'AdWords' => SchulzeFelix\AdWords\AdWordsFacade::class,
    ...
];

您可以使用此命令发布此软件包的配置文件

php artisan vendor:publish --provider="SchulzeFelix\AdWords\AdWordsServiceProvider"

生成刷新令牌

这需要 clientIdclientSecret 来自 原生应用

Google Console: https://console.developers.google.com/apis/credentials

$ php artisan adwords:token

打开授权 URL。授权应用程序并输入控制台中的访问令牌。将刷新令牌复制到配置文件 config/adwords-targeting-idea-service.php

使用方法

所有方法都将返回一个 Illuminate\Support\Collection-实例。

以下是两个基本示例,用于检索多个关键词的搜索量以及给定单词的新关键词想法。

搜索量

$searchVolumes = AdWords::searchVolumes(['cheesecake', 'coffee']);

关键词想法

$keywordIdeas = AdWords::keywordIdeas('coffee');

提供流畅的配置

设置位置

有关标准 ID,请参阅 https://developers.google.com/adwords/api/docs/appendix/geotargeting

AdWords::location(2276)->searchVolumes(['cheesecake', 'coffee']);

设置语言

有关标准 ID,请参阅 https://developers.google.com/adwords/api/docs/appendix/codes-formats#languages

AdWords::location(2276)->language(1001)->searchVolumes(['cheesecake', 'coffee']);

包含目标每月搜索量

AdWords::withTargetedMonthlySearches()->searchVolumes(['cheesecake', 'coffee']);

将 NULL 值转换为零

AdWords::convertNullToZero()->location(2276)->language(1001)->searchVolumes(['cheesecake', 'coffee']);

包含和排除关键词想法中的单词

AdWords::location(2642)->exclude(['iphone'])->include(['apple'])->keywordIdeas('iphone');

变更日志

有关最近更改的更多信息,请参阅 CHANGELOG

测试

$ vendor/bin/phpunit

贡献

有关详细信息,请参阅 CONTRIBUTING

安全

如果您发现任何安全问题,请通过电子邮件 github@schulze.co 而不是使用问题跟踪器。

致谢

许可

MIT 许可证 (MIT)。有关更多信息,请参阅 许可文件