Opened 2 years ago

Closed 17 months ago

#2791 closed New feature (fixed)

Social networks tab and widget

Reported by: codax Owned by: capedfuzz
Priority: major Milestone: 1.10 - Piwik 1.10
Component: Core Keywords:
Cc: matthieu.aubry@… Sensitive: no


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

Attachments (3) (73.8 KB) - added by codax 2 years ago.
Socials_png_list.rar (46.8 KB) - added by codax 22 months ago.
Social networks png list
referrers.patch (16.7 KB) - added by codax 20 months ago.

Download all attachments as: .zip

Change History (16)

Changed 2 years ago by codax

comment:1 Changed 2 years ago by codax

referrers.patch - main patch file for the referrers plugin. - new files (.ico of socials and .csv) that should be unzipped to the related folders.

comment:2 Changed 2 years ago by matt (mattab)

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.


comment:3 Changed 2 years ago by codax

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!

comment:4 Changed 2 years ago by greg (gka)

big +1 for this feature!

comment:5 Changed 22 months ago by codax

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.


Changed 22 months ago by codax

Social networks png list

comment:6 Changed 22 months ago by codax

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


comment:7 Changed 21 months ago by matt (mattab)

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 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 :)

comment:8 Changed 20 months ago by matt (mattab)

  • Priority changed from normal to major

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

Changed 20 months ago by codax


comment:9 Changed 20 months ago by codax

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.

comment:10 Changed 20 months ago by matt (mattab)

  • Milestone changed from 1.8.x - Piwik 1.8.x to 1.8.4 - Piwik 1.8.4
  • Owner set to capedfuzz

Very cool, thank you codax! :)

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

comment:11 Changed 18 months ago by matt (mattab)

  • Milestone changed from 1.9.2 - Piwik 1.9.2 to 1.9.1 - Piwik 1.9.1

comment:12 Changed 18 months ago by halfdan

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

Instead of checking for you should check for "".

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

Have a look at this Tweet: The URL shown is, but if you hover it you see that it is actually shortened to

If you look at the Piwik Demo ( you can even see show up in the list of Referrer Websites.

comment:13 Changed 17 months ago by capedfuzz (diosmosis)

  • Resolution set to fixed
  • Status changed from new to closed

(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.

Note: See TracTickets for help on using tickets.