Laravel AdWords 目标想法服务的包装器

1.9.0 2022-03-20 11:34 UTC

This package is auto-updated.

Last update: 2024-09-20 17:03:51 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)。有关更多信息,请参阅 许可证文件