2017 © Pedro Peláez
 

silverstripe-module silverstripe-social-proof

Social Media tracking

image

marketo/silverstripe-social-proof

Social Media tracking

  • Tuesday, April 4, 2017
  • by nyeholt
  • Repository
  • 14 Watchers
  • 2 Stars
  • 95 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 3 Forks
  • 1 Open issues
  • 3 Versions
  • 1 % Grown

The README.md

# SilverStripe-Social-Proof

SilverStripe Social Statistics module

Maintainer Contact

Kirk Mayo, (*1)

, (*2)

Requirements

  • SilverStripe 3.2
  • Access to create cron jobs
  • https://github.com/silverstripe-australia/silverstripe-queuedjobs
  • https://github.com/kmayo-ss/twitter-stripe

Documentation

The module is used query social statistics for different web pages and store the information and provide this information via an API, (*3)

Setup

The Twitter service makes use of another SilverStripe module which uses Oauth to use the Twitter API. You will need to consult the the Readme file (../twitter-stripe/README.md) for details on setting up the Oauth details. The module config.yml also contains a setting under SocialProofSetting which is used to lock the urls down to certain domains., (*4)

Services

The module queuries various social media services which are managed via config.yml To add another service you will need to create a class with the properties service and statistics as these are used when adding a row to the URLStatistics model. The class will also need to declare a method called processQueue which is used in a cron job, this is enforced by a interface called SocialServiceInterface which should be implemented in any future service classes., (*5)

API Endpoints

Curently the following API endpoints exist, (*6)

http://socialproof.stripetheweb.com/api/countsfor?urls=http://[urltobeprocessed]
http://socialproof.stripetheweb.com/api/countsfor/service/facebook?urls=[urltobeprocessed]
http://socialproof.stripetheweb.com/api/countsfor/service/twitter?urls=[urltobeprocessed]
http://socialproof.stripetheweb.com/api/countsfor/service/linkedin?urls=[urltobeprocessed]
http://socialproof.stripetheweb.com/api/countsfor/service/linkedin?urls=[urltobeprocessed]
http://socialproof.stripetheweb.com/api/countsfor/service/google?urls=[urltobeprocessed]

Accepting third party AJAX requests

If you want to allow third party javascript requests to query the service (like AJAX) you will need to set the CORS flag in your yml config to true so that the Access-Control-Allow-Origin header gets sent back to the requesting browser as per the example below., (*7)

Querying the API from a third party can be done with jQuery or AJAX. A simple synchronous javascript example is below where you can just call the function requestInfo with the host and the request., (*8)

``` javascript function requestInfo(host, request) { var xhr = new XMLHttpRequest(); xhr.open("GET", host + request, false); xhr.send();, (*9)

return xhr.response;

}, (*10)

// call with the following // var result = requestInfo('http://192.168.0.1/', 'geoip/50.206.151.39.json');, (*11)


SocialAPI: allow_cors: true, (*12)


You can also add an IP whitelist for the domains that you want to be processed by using:

SocialAPI: allowed_domains: - blog4.marketo.com, (*13)


If you want to map development domains to production domains, you can use the following: ```SocialAPI: domain_mapping: localdomain.dev: blog4.marketo.com

Domains can also use wildcards for matching subdomains:, (*14)

SocialAPI: allowed_domains: - *.marketo.com allowed_domains: - *domain.dev: blog4.marketo.com, (*15)

Composer Installation

composer require solnet/socialproof, (*16)

TODO

Testing, (*17)

The Versions

04/04 2017

dev-master

9999999-dev

Social Media tracking

  Sources   Download

BSD-3-Clause

The Requires

 

by Kirk Mayo

analytics social tracking silverstripe media

04/04 2017

1.1.0

1.1.0.0

Social Media tracking

  Sources   Download

BSD-3-Clause

The Requires

 

by Kirk Mayo

analytics social tracking silverstripe media

22/02 2016

1.0.0

1.0.0.0

Social Media tracking

  Sources   Download

BSD-3-Clause

The Requires

 

by Kirk Mayo

analytics social tracking silverstripe media