Trying to implement Piwik using REST API over http but need a little help.
What I'm trying to do is get the analytics for a particular page where a custom field = x.
I'm not sure if I'm going about it the right way but I have this so far:
http://www.mysite.co.uk/dashboard/analytics/index.php?module=API&method=VisitsSummary.get&idSite=1&period=month&date=today&segment=customVariableValue1==x&filter_limit=20&format=xml&token_auth=xxxxxxxxxxxxxxxxx
My custom field is set up and viewable in the admin.
However the result just seems to return 0 for everything. I'm testing by inserting the url directly into a browser and also by fetching in php.
Also is there a method to get all statistics for a particular page and given date range where custom field = x? I can't seem to see one in the API docs.
Any help/ examples would be appreciated.
In case anyone else happens to be looking for this I ended up using the getPageUrl method:
$url = "http://www.mysite.co.uk/piwik/index.php?module=API&method=Actions.getPageUrl&pageUrl=/foo.php?id=" . $id . "&idSite=1&period=month&date=today&format=php&filter_limit=1&token_auth=xxxx";
regards,
fl3x7
Related
So I've searched the web end on end looking for just the steps to get me in the right direction but can't seem to find it.
So what i'm trying to do is as follow:
Create a web application with php that has simple functionality.
Functionality as follows:
Firstly - It needs to go check a public facebook group to see if the group itself has made a post, and if so the app needs to return a circle. The circle will be an indication that there's been a public post.
Secondly - If there's been no public post it needs to display a different color circle.
Thirdly - if there were no schedule posts for that day it needs to display another different color circle.
I'm trying to do this WITHOUT facebook graph API and without access tokens. As far as i understand there's no need for tokens as its a public group making public posts.
I've also read up a but about php-curl but so far I can't manage to get what i'm looking for.
All i ask for is guidance in the right direction or what you can offer me.
Thanks in advance for your help.
Using the API is the suggested method but if you really want to scrape post info you can try https://pastebin.com/QjxN0ZUY
This part in the code is where you define the regex of what you want to extract, in this demo I have just extracted the date of the post as it was the easiest.
$searchREGEX = '/\<abbr\>(.|\n)*?\<\/abbr\>/';
Hope this helps, good luck !
you can try what #zac is suggesting you can also try and use 1 or more scraping methods.
for me i scrape sometimes with PHP-curl and the Dom Document to read what i get. this can be heavy because you need to pull the web page every x amount of time.
Next what i use also for testing but is suitable for web scraping or just going on other sites is Panther (https://github.com/symfony/panther) this uses a web browser so you can also incorporate some sort of screenshot system to see if you have the right data ()
we are facing a major issue on the Instagram API calling section using PHP (Codeigniter 3). First of all we want to tell you that our app in in live mode and we are very sure of that . The pagination URL object is coming blank after 20 images and we have tried different ways using the COUNT parameter on the section and the next_max_id and next_min_id but all in vain. So please suggest us some new way to do this section. We can not use javascript on this section according to our requirements.
Some of the small example are below how e call the api and what are we using.
https://api.instagram.com/v1/users/self/media/recent/?access_token=3963420514.440235f.df3a5b4f9d6546cb9512ffd0a13ae62f&count=13
https://api.instagram.com/v1/users/3963420514/media/recent?
Thank you in advance.
I checked your API response it has pagination data
just use the pagination.next_url to get the next set of 13 posts via API, I tried it, it worked with your API above.
If not you can also maually add &max_id={value of pagination.next_max_id} to the API to get next set of posts
I'm trying to get the comment count on a WordPress post as a PHP variable.
For some reason comments aren't syncing properly between disqus and WordPress so get the comment count from WordPress locally isn't an option.
Does anyone have any ideas about how to go about this? There's an API and PHP wrapper but I'd like to see if there's an easier way before I get stuck into the API.
Thanks!
PS I need as a PHP variable so posts can receive an rating based on likes, favourites and comments so getting it in JS isn't really an option.
Thanks!
I don't think you have other options to get the data on the server side other than using the Disqus APIs.
I think that the correct API for doing this is: http://disqus.com/api/docs/threads/set/
You can understand how it works from this example in JS: http://help.disqus.com/customer/portal/articles/1131783-tutorial-get-comment-counts-with-the-api the results are the same, so it should be your code.
cant quite find the answer I need so hopefully you guys can help.
I am trying to develop ( with basic but growing knowledge!) a split search bar for a custom cake website.
basically I have one search bar in the header, and a drop down with whole site and cakes in it.
When the whole site is selected I want it to pass the search parameters to googel custom search and display on the page. when cakes is selected it triggers a custom php search I wrote to search for and display a single cake picture.
I am doing this at the moment with an if statement. so if type=cakes then ( run php () else put search terms through google custom search.
Now I have tried using the results only format for it, but it doesnt seem to render anything! I dont know how to pass my parameter to the results page. I tried setting the parameter to cakeref which is what i have specified previously.
Any help or explanations as to how google custom search works and integrates would be amazing.
Try this
$search_query = "Is+Wikipedia+IsGreat";
$amazon_url = "https://www.googleapis.com/customsearch/v1?key=3425lh43lkh52lk34jh5&cx=023470239740:kj2h3kl4hlk23&alt=atom&num=5&q='$search_query'";
$google_search = file_get_contents($amazon_url);
You need API Key and CX number for calling this API. And urlencoding to encode query parameters.
Try Curl also..
API Client Library is here
http://code.google.com/p/google-api-php-client/
http://code.google.com/p/google-api-php-client/source/browse/trunk/examples/customSearch/index.php
http://www.phpclasses.org/package/6301-PHP-Perform-searches-with-the-Google-Site-Search-API.html
I'm trying to figure out how to pass in segmentation params to filter out results in the 'Dashboard' for specific custom variables we're storing in the db - but just haven't found the right solution.
This is what I've got as my src for the iframe:
http://www.domain.com/piwik/index.php?module=Widgetize&action=iframe&moduleToWidgetize=Dashboard&actionToWidgetize=index&idSite=<?=cstPIWIKSITE?>&period=week&date=yesterday&segment=customVariableName4==<?=$key1?>;customVariableValue4==<?=$value1?>;customVariableName5==<?=$key2?>;customVariableValue5==<?=$value2?>
The scope of the custom variables is set to "visit" and I've ensured that the data is indeed being stored in log_visit in the fourth and fifth custom var fields.
This issue is that there is this message on every widget = "There is no data for this report."
Conversely, when I remove the segment params from the src above, I do indeed get results. However, I need this to be segmented out as different divisions should be able to mine their own analytics.
In case you need this info:
Piwik Version: 1.9
This is a standalone PHP site (not utilizing WP, Joomla, etc.)
'Anonymous' has 'VIEW' access
From global.ini.php = anonymous_user_enable_use_segments_API = 1
Any help whatsoever would be greatly appreciated!
This seems to be a bug in Piwik <= 1.9.1, where the dashboard is empty if more than one segment is used.
Here's a forum thread with others who have experiencedd the same thing (towards the bottom of the thread):
http://forum.piwik.org/read.php?2,92057,96203