Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Social networks tab and widget #2791

anonymous-piwik-user opened this Issue Nov 22, 2011 · 15 comments


None yet
5 participants

Hello there!

We have done some work with the 'Referrers' plugin and added a new tab "Referrers"->"Social Networks", where you can see entry counts and referrer link from many social networks.

And it works this way:

It requests to the website list (like it does for the "Referrers"->"Websites" tab) and after that it uses the 'pattern' filter.

The list of social networks is here: /piwik/plugins/Referers/data/socials.csv (55 snw)

Each social network gets related icon (like it does for the "Referrers"->"Search Engines & Keywords" tab) from the piwik/plugins/Referers/images/socials folder.

Also we created a new widget: 'Referrers/list of social networks' and we find it very useful. You can add this on you dashboard now.

So that's it.

We would like to make it able to view this social networks info also in the "Referrers"->"Overview" tab. But unfortunately it can't be done using a filtering. So we just put it aside for a while.

If you have some ideas about all this social networks features -- that could help to make it more useful -- we would love to hear from you and try to make it real.

See the attachments for the core patch.

''Best regards.
Codax team''

referrers.patch - main patch file for the referrers plugin.

csv_img.zip - new files (.ico of socials and .csv) that should be unzipped to the related folders.


mattab commented Nov 22, 2011

Thanks codax for the patch!! Excellent idea :-)

Are you interested to include this in core? It would be great to have this in Piwik core.

Here is the code review as per our development process

  • Could you change the CSV file and instead put the list of Social networks in a simple php similarly to the search engines file (see other data files in same folder).
    It will make the code simpler.
  • also, please put the images in png format, in the folder plugins/Referers/images/social (for consistency with other images).
  • Also, the output could be part of the Metadata API (so that the new report can be added to PDF/HTML reports and will appear in Piwik Mobile app), see code in https://github.com/piwik/piwik/blob/master/plugins/Referers/Referers.php#L54


Thank you Matt!

Yes, we are very interested in including this in core ;)

We'll do all the changes you recommended a little bit later. We're kinda busy for a few days and we're really sorry about that.

Thanks for the feedback!


gka commented Nov 24, 2011

big +1 for this feature!

Hello guys!

And we are sorry for not responding on this ticket. Now it seems like we are stable again and getting back to contribution in Piwik developing.

So now we have fixed things with Social networks feature due to all Matt's recommendations. We re-upload the patch for the Piwik core in this ticket.

And it works this way:

1. When a referrer URL writes down in Piwik (log_visits mysql table) Referrers plugin defines it as a social network referrer (if there is a match with the list of the most popular 50 social networks Socials.php).

2. Now the social networks list is in php format and also changed its folder to /core/DataFiles/ so as Piwik standards want. Socials.php will be created while applying the patch.

3. Social networks icons have all been changed to png.

4. The social network output is now part of the Metadata API and can be imported.

5. Now all graphs related to the social networks are shown well.


Attachment: Social networks png list

A little thing has been fixed
So get the new .patch file



mattab commented Jul 20, 2012

Thank you for the new patch!

  • It looks good
  • I think now that it is important not to add any archiving code for this new data
    • instead I propose that the API referer.getSocials() calls the API getWebsites() to get the data, then applies a DataTable_Filter to only get the Social websites, and dynamically builds the datatable and returns it.

The data therefore is more a filter on the getWebsites and not a new data blog. There will be no performance impact of this new feature.
Also I think it's beest not to exclude Sites and Social between each other. Because facebook.com is still a website. So it would be confusing that Facebook does not count as a website. I think it's best to count "Social" as a subset of websites. Therefore the data in log_visit is still the same :-)

  • Finally, it would be nice if the Social report was displayed on the right of the Websites report under REferers > Websites & Social

IT's a great feature :-)
Looking forward to seeing it in core :)


mattab commented Aug 26, 2012

It is a great feature, and many users have expressed very strong interesting in Social Tracking! :)

Hello again!

We make the recommended changes and now the Social Networks report is:

- not excluded from Website referrers
- displayed on the right of the Websites report under the tab "Referers > Websites & Social"

Get the re-attached .patch file for core.


mattab commented Sep 6, 2012

Very cool, thank you codax! :)

Benaka, please commit the change after doing your own review of the feature (looks good to me) - Thank you!


halfdan commented Oct 24, 2012

I see a problem here with Twitter - you usually don't get "twitter.com" as referrer as all URLs are automatically shorted by Twitters own http://t.co/ service.

Instead of checking for twitter.com you should check for "t.co".

I think the same applies for links from Facebook that are shortened to "fb.me".

Have a look at this Tweet: https://twitter.com/piwik/status/258798351611469824. The URL shown is fb.me, but if you hover it you see that it is actually shortened to t.co.

If you look at the Piwik Demo (http://demo.piwik.org/index.php?module=CoreHome&action=index&idSite=7&period=month&date=2012-10-13#module=Dashboard&action=embeddedIndex&idSite=7&period=month&date=2012-10-13&idDashboard=1) you can even see t.co show up in the list of Referrer Websites.


diosmosis commented Nov 14, 2012

(In [7466]) Fixes #2791, committed codax's patch after modification. Two new reports added, getSocials & getUrlsForSocial. New utility function for DataTable called mergeSubtables added. Modified ColumnCallbackDeleteColumn filter so the function callback used can take extra parameters.

@anonymous-piwik-user anonymous-piwik-user added this to the 1.10 - Piwik 1.10 milestone Jul 8, 2014

This issue was closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment