Skip to content

Using PHP & Javascript, we are able to count the actions taken on social media. Tracks Twitter, Facebook, Linkedin & GooglePlus.

Notifications You must be signed in to change notification settings

ccagle8/php-js-social-action-counter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PHP & JS Social Media Action Counter

This code was created to help count the number of times a like or tweet or share button was clicked on a particular page.

Setup

  • Signup for a developer account on Facebook. Create an app, and grab that App ID.
  • Add that App ID to two pages: social.js and index.php
  • Change the domain listed in social.js to your domain - It needs to point to your channel.php
  • Make sure that the page that has the social buttons on it has all the meta information filled out. This is where the buttons get their data from.
  • socialcounter.php needs to have a MySQL connection. So include your connection file, or connect to MySQL at the top.
  • When socialcounter.php saves the data to the database, it assumes the schema that is listed in stats.sql
  • Ensure that social.js is pointing to the correct place when it is looking for socialcounter.php
  • At the top of index.php, there is a PHP $_SESSION variable. This should be a unique value for whatever page is being shown. (This assumes that you have multiple pages you want to track actions on separately.)

Note: I've documented each step within the code. There are a lot of links to resources within the code. Hopefully this saves someone from having the same trouble I did finding the stuff...

About

Using PHP & Javascript, we are able to count the actions taken on social media. Tracks Twitter, Facebook, Linkedin & GooglePlus.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published