承接 weblagence/laravel-facebook-pixel 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

weblagence/laravel-facebook-pixel

最新稳定版本:v1.1

Composer 安装命令:

composer require weblagence/laravel-facebook-pixel

包简介

Facebook Pixel integration for Laravel

README 文档

README

Facebook Pixel integration for Laravel

Latest Version on Packagist Software License Quality Score Total Downloads

An easy Facebook Pixel implementation for your Laravel application.

Facebook Pixel

The Facebook pixel is a snippet of JavaScript code that allows you to track visitor activity on your website. It works by loading a small library of functions which you can use whenever a site visitor takes an action (called an event) that you want to track (called a conversion). Tracked conversions appear in the Facebook Ads Manager and in the Facebook Analytics dashboard, where they can be used to measure the effectiveness of your ads, to define custom audiences for ad targeting, for dynamic ads campaigns, and to analyze that effectiveness of your website's conversion funnels.

For concrete examples of what you want to send throught the Standard Events

Install

You can install the package via Composer:

composer require weblagence/laravel-facebook-pixel

In Laravel 5.5 and up, the package will automatically register the service provider and facade

In L5.4 or below start by registering the package's the service provider and facade:

// config/app.php

'providers' => [
    ...
    WebLAgence\LaravelFacebookPixel\LaravelFacebookPixelServiceProvider::class,
],

'aliases' => [
    ...
    'LaravelFacebookPixel' => WebLAgence\LaravelFacebookPixel\LaravelFacebookPixelFacade::class,
],

Next, publish the config file:

php artisan vendor:publish --provider="WebLAgence\LaravelFacebookPixel\LaravelFacebookPixelServiceProvider"

Configuration

The configuration file is fairly simple.

return [

    /*
     * The Facebook Pixel id, should be a code that looks something like "XXXXXXXXXXXXXXXX".
     */
    'facebook_pixel_id' => '',
   
    /*
     * Use this variable instead of `facebook_pixel_id` if you need to use multiple facebook pixels
     */
    'facebook_pixel_ids' => [],
    
    /*
     * Enable or disable script rendering. Useful for local development.
     */
    'enabled'           => true,
];

Usage

Basic Example

First you'll need to include Facebook Pixel's script. Facebook's docs recommend doing this right after the body tag.

{{-- layout.blade.php --}}
<html>
  <head>
    @include('facebook-pixel::head')
    {{-- ... --}}
  </head>
  <body>
    @include('facebook-pixel::body')
    {{-- ... --}}
  </body>
</html>

Send pixel

At any moment, you can use the next function to create a Standard Event

\LaravelFacebookPixel::createEvent($eventName, $parameters = []);

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email jeremy@weblagence.com instead of using the issue tracker.

License

The MIT License (MIT). Please see License File for more information.

统计信息

  • 总下载量: 105.1k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 36
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 35
  • Watchers: 3
  • Forks: 14
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-01-15