1

I developed a mobile site using html and angularjs, which displays all of data from my Drupal site. From a view that output JSON data. All data collect good from JSON, but i can't create a popular item list.

Since, drupal not update node view by json request. So, i think, if i collect total request of each json/view, i can filter by this from my mobile site. So, i need to display how many times this json/view is requested from other domain/website like statistics module.

Does any method to track how many times a specific JSON/VIEW is called or requested from another domain/website?

2
  • Do you want to count the total times the view is accessed via the url and not by node the view references? Add a custom module and on path (or views hook) write to a custom db table. How you expose it depends if the table contains just a counter (one row and field), or multiple fields that will have multiple rows. Just a counter: a manual query result on a url that returns json. Many rows: add a views plugin to access the table then expose via views_datasource. Also possible to use custom node bundle with fields that you update instead of creating new table: easy to implement but more overhead Commented Sep 27, 2015 at 11:04
  • Hmm, nice approach. :) Thanx Reynolds...
    – Tazim
    Commented Sep 27, 2015 at 12:36

1 Answer 1

0

There is a core module for that Statistics. On the configuration of this module (admin/config/system/statistics) you can ask for 'Count content views' who should work on every page drupal display (so your json).

There are a lot of custom module to extends statistics.

A little warning : Angular may be cache your json, so if your user go two times on a page you can loose this data. Maybe smarter to do this on the angular side.

4
  • I know about statistics module, but it can count when user visit drupal page, but my mobile user can't visit my drupal site. they can only visit my angular custom site that build using json from drupal site.
    – Tazim
    Commented Dec 3, 2014 at 5:20
  • Unfortunately why i can't find any solution from this site for drupal problem? Its so grievous...
    – Tazim
    Commented Dec 3, 2014 at 12:26
  • I may misunderstand but for me when you mobile user visit your custom angular site, angular ask by ajax (get I guess) the Json file on the drupal site. Here is your visit. When the client do a ajax call to your drupal site it will be count as a visit. Commented Dec 4, 2014 at 15:57
  • Thanx your reply @Clément, i trying to do this using views & i search too much in google and drupal forum, bt can't. Can u pls help me with an example... Waiting...
    – Tazim
    Commented Dec 5, 2014 at 17:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.