marshmallow / google-ads-lead-extension
This package will help you handle leads that come in from Google Ads Leads Extension.
Requires
- php: >=7.0.0
- marshmallow/commands: ^1.0
This package is auto-updated.
Last update: 2024-11-06 12:29:15 UTC
README
Google Ads Lead Extension
This module will make it very easy to handle leads that come in from the Lead Extension in Google Ads. You will be able to do whatever you want to do with the data that is sent to you by Google Ads.
Installing
composer require marshmallow/package-google-ads-lead-extension
Run the installer so everything is setup correctly
php artisan googleads:install-lead-extension
The installer will generate a Google Key
for you. This will be shown in your console while running the installer. You will need this key for setting up your lead extension. This key will be used to validate the request is allowed. If you've lost your key, we store the generated key in your .env
file so you can always find it there under GOOGLE_ADS_LEAD_EXTENTION_KEY=...
.
Make sure Google Ads can reach you!
Update your App\Http\Middleware\VerifyCsrfToken.php
file so Google will be allowed to do a POST request to your system.
<?php namespace App\Http\Middleware;
use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as BaseVerifier;
class VerifyCsrfToken extends BaseVerifier
{
protected $except = [
...
config('google-ads-lead-extension.prefix') . '/*',
];
}
Set up the notifier
By default this package will sent you an email when a new lead is available. The only thing you need to do is adding your emailaddress to the config. Go to the config file config/google-ads-lead-extension.php
and setup your emailadress.
<?php
return [
...
/**
* Emailaddress where new leads will be mailed to.
*/
'conversion-email-address' => 'INSERT YOUR EMAILADDRESS HERE',
...
];
Do your magic with the lead
After you've run the installer and made sure Google can reach this URL by making the nessesary adjustments in VerifyCsrfToken.php
you are ready to work your magic. The installer has generated a new class in you app directory. You can find this class in app/GoogleAdsLeadExtension.php
. This class has 2 methods for you to work with.
handle()
In this method you can do what you need to do with the available data. The available methods to retreive data from the Lead are available in the documentation in the app/GoogleAdsLeadExtension.php
file. Use this function to add to lead to your database, to your CRM. What ever you need.
notify()
This method is commented out. This is because we have a default notify method available which will sent you an email with the lead data. If you want to change this behaviour, you can uncomment the notify method and work your own magic.