Welcome to WebmasterWorld Guest from 54.162.159.33

Forum Moderators: not2easy

Tracking how many times a page on my site has been shared

     
1:13 am on Jun 30, 2018 (gmt 0)

Senior Member

WebmasterWorld Senior Member 5+ Year Member Top Contributors Of The Month

joined:Mar 15, 2013
posts: 925
votes: 77


Can you guys suggest a way that I might more accurately track when a page on my site is shared on Facebook?

I currently have a button on each page to share on Facebook or Twitter, and when the user shares from one of those buttons I have an Ajax script to simply +1 in a MySQL database. But when the user just copy and pastes a link, I don't know of a way to track it.

I thought about putting something like this in my head:

<meta property="og:image" content="https://www.example.com/count.php?image=foo.jpg">


then use count.php to update the MySQL database. I'm not entirely sure if that would even work, but if so then of course it would count how many times the picture is actually shown instead of how many times it was shared... which has value of its own, I guess, but not quite the same thing.
1:19 am on June 30, 2018 (gmt 0)

Moderator from US 

WebmasterWorld Administrator keyplyr is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Sept 26, 2001
posts:12591
votes: 841


it would count how many times the picture is actually shown instead of how many times it was shared
No, FB caches the OG image and servers it each time a user views it from their image cache. FB uses persistent caching.

Using this method, you could only account for the times a unique user actually shares your page URL to a new FB page.