Giter VIP home page Giter VIP logo

fake-facebook-pixel's Introduction

Fake Facebook Pixel

A simple project to serve as an endpoint for Facebook advertising pixel pings for development and debugging callouts made to https://www.facebook.com/tr/?id=*******&ev=PageView.

I created this to test and debug Facebook pixel integration without actually hitting Facebook.

How To Use

Generate a Self Signed SSL Certificate

Since the endpoint has to be served from https, you will need to generate a self signed ssl certificate with the name www.facebook.com and "Always Trust" it locally. You will still see the browser warning that the site is "Not Secure", but it will work.

The following instructions are based on macOS Sierra

  1. Open the "Keychain Access" application
  2. Keychain Access > Certificate Assistant > Create a Certificate...
  3. Assign Name as "www.facebook.com", Identity Type as "Self Signed Root", Certificate Type as "SSL Server"
  4. Click "Create", "Continue" and "Done" as required
  5. Find the newly created certificate in Keychain Access
  6. Double Click and select "Always Trust" under Trust > When using this certificate. Clost window
  7. Right Click on the certificate and select "Export ......"
  8. Save the .p12 file in the same folder as server.py
  9. Convert it to the .pem format using the command openssl pkcs12 -in www.facebook.com.p12 -out www.facebook.com.pem -nodes

Modify You Hosts File

vim /private/etc/hosts

Add www.facebook.com as an alias for 127.0.0.1

127.0.0.1 localhost www.facebook.com

The reason why this works out is because the actual Facebook tag that implements the fbq function is loaded from connect.facebook.net, which is not in the hosts file. Hence, the plumbing loades succesfully.

The https://www.facebook.com/tr/ endpoint is used for pinging the pixel, which we are intercepting and simply logging!

Make Sure Port 80 is Open

On macOS Sierra, I had to make sure

  • Firewall was turned off
  • The default https service was stopped sudo apachectl stop

Launch Server

sudo python server.py

sudo is required to serve on port 80

Start Debugging!

Lauch the page you want to test debug and as it loades and pings the Facebook pixel, you will see the query and parameter details on the STDOUT from server.py

fake-facebook-pixel's People

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Forkers

sandy4321

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.