openbuildings / swiftmailer-google-campaign
将谷歌营销参数添加到所有电子邮件链接
0.3.0
2020-02-14 12:04 UTC
Requires
- php: ^7.1
Requires (Dev)
- phpunit/phpunit: ^7
- swiftmailer/swiftmailer: ^5.0
This package is not auto-updated.
Last update: 2024-09-14 15:11:10 UTC
README
一个swiftmailer插件,可以从配置文件或自定义文件自动将谷歌营销参数添加到所有电子邮件链接
用法
$mailer = Swift_Mailer::newInstance(); $mailer->registerPLugin(new GoogleCampaignPlugin([ 'utm_source' => 'source', 'utm_campaign' => 'email', 'utm_medium' => 'email' ]);
在发送电子邮件之前,插件将添加营销参数到所有链接
<html> <body> <a href="http://example.com">Example.com</a> </body> </html>
将被转换为
<html> <body> <a href="http://example.com?utm_source=source&utm_campaign=email&utm_medium=email">Example.com</a> </body> </html>
该插件还支持将额外的营销活动嵌入到您的电子邮件中
$mailer = Swift_Mailer::newInstance(); $mailer->registerPLugin( new GoogleCampaignPlugin( [ 'utm_source' => 'source', 'utm_campaign' => 'email', 'utm_medium' => 'email' ], [ 'your_campaign' => [ 'utm_source' => 'my_custom_source', 'utm_campaign' => 'my_custom_campaign' ] ] ) );
要将自定义营销活动嵌入到您的电子邮件中,只需将 google_campaign
查询参数添加到您的链接,其值为 - 您的营销活动名称
<html> <body> <a href="http://example.com?google_campaign=your_campaign">Example.com</a> </body> </html>
将输出
<html> <body> <a href="http://example.com?utm_source=my_custom_source&utm_campaign=my_custom_campaign">Example.com</a> </body> </html>
许可证
版权所有 (c) 2013, OpenBuildings Ltd. 由Yasen Yanev作为 clippings.com 的一部分开发
根据BSD-3-Clause许可证,请参阅LICENSE文件。