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
Related
Few pages of my WordPress site generating weird session id next to page url for example http://www.example.com/?wvsessionid=wvac7224adb9a344b4b05354762584a621 . I don’t know where this coming from. bad thing is google indexing them & it creating duplicate content issue. where should i look for this issue & any idea , how I can solve it?
This could be one of two things:
some plugin is generating this, in that case search in plugins code to look for wvsessionid phrase which will tell you which plugin is generating this and why.
another option is some injected code due to hacking but that less likely as this parameter wouldn't be of much help.
I want to load pages from PeoplePerHour.com into python to run some data analysis, but it keeps getting data from a page I didn't ask for, I think it must go to the main page and then refreshes somehow into the page I ask for.
For example:
I want to pull the prices from all users at http://www.peopleperhour.com/freelance/data+analyst, and the data spans over multiple pages.
Say I want to request page 2, http://www.peopleperhour.com/freelance/data+analyst#page=2. If I go here in a browser, it works fine and pulls up page 2, but I think it pulls up page one first and then "refreshes" into page 2 (I think). If I access this in python, it loads the HTML from the first page, and never sees page 2.
Here's my code:
import requests
from pattern import web
import re
import pandas as pd
def list_of_prices(url):
html = requests.get(url).text
dom = web.DOM(html)
list = []
for person in dom('.freelancer-list-item .medium.price-tag'):
currency = person('sup')
amount = person('span')
list.append([currency[0].content if currency else 'na', amount[0].content if amount else 'na'])
return list
list_of_prices('http://www.peopleperhour.com/freelance/data+analyst#page=2')
No matter what, this returns the prices from page 1.
What is going on that I'm just not seeing?
If I understand correctly, you want to iterate through the pages. If that's the case, I believe the problem is with your URL.
Here's the URL you gave:
http://www.peopleperhour.com/freelance/data+analyst#page=2
The problem is, "page" is not a bookmark on that page. When you use the #page=2, it tells the browser to go down to the same page for a bookmark called "page=2".
Here's the URL for the Next button in that site:
http://www.peopleperhour.com/freelance/data+analyst?sort=most-relevant&page=2
You'll see it says "&page=2" which means something else. In their code "page" is a variable being passed via the url, with a value of 2. You use the "&" if there are more than one of these variables. Also, you are missing a "?" symbol. If you're passing variables via the URL, you have to put a ? followed by the name=value pairs for your variables.
So, easy fix, change your url to this:
http://www.peopleperhour.com/freelance/data+analyst?page=2
That's in comparison to your old url:
http://www.peopleperhour.com/freelance/data+analyst#page=2
As a quick test, copy/paste the corrected url on your web browser. You will see it now is on page 2.
Getting dynamic content (those generated by client-side code) is always very tricky. There is no easy solution to this, but if you really want to dig into it, I recommend PyV8, a JavaScript engine in Python.
Error in pattern when using pattern3 in python 3.6
Please click on the above Hyperlink to open the Image
What is the alternative to executing the same code under python3.6 environment because due to this I have to install the pattern3, the pattern is not supported by the python 3.6
Thanks!
I've been tasked with providing the backend for a news feed that will be used by our company apps. The feed will pull articles from our current website, which is built with ModX (evolution). So far, I've designed the feed to send JSON through a specified url containing the needed information. It's currently in the following format (using Ditto placeholders):
{
"title":"[+longtitle+]",
"description":"[+description+]",
"link":"[(site_url)][~[+id+]~]"
},
Here's my issue - the link I'm providing through the JSON (in the link tag) opens the full, desktop version of the page. Our current site is not responsive, and was not originally designed to handle mobile devices. We would like to open a small, clean page showing ONLY the ['content'] of that particular article. I'm looking for a way to link to a page showing only this content - no header, no footer, nothing.
I know that I could create a new page to handle all of this, but it needs to be dynamic. New articles are created regularly, and I'd like to avoid having to add another page to handle this for every article, while also making it simple for the writing team to integrate this feature.
One of my ideas so far is:
Pass a GET parameter to the URL "link" in the JSON - something like - www.mysite.com/article1?contentOnly=true. Then, in my article, detect this parameter in PHP and handle accordingly. I would need this snippet on each article written, so it may cause issues down the road if our staff writers forget to add it.
I haven't worked with ModX long, so I'm assuming there's a better way to handle this. Any ideas would be greatly appreciated. Please let me know if I need to provide more information.
I am not 100 % sure how you have done this, but here's my tip.
Don't use the resource itself to output the JSON. Doing this based on a GET-paramter will required the entire site to be uncached. Instead, use a single resource for the feed and supply the id/permalink there.
For example: mysite.com/feed?id=1, mysite.com/feed?latest or something like that.
Done this way, you could have an empty template with just the snippet that is parsing to JSON in it. This has to be uncached of course, but the rest of the site could be cached as normal.
So, I've read The Loop and I got the hang of it. (I created a page that lists the 3 most recent posts, a page that shows a page (as opposed to a post), and so on.)
However, it seems silly that, in order to integrate a WordPress blog into an existing site, I'd have to replicate all the different kinds of pages (lists of posts, the posts themselves, pages, etc.)
Is there a generic way of doing this?
The full idea is something like this.
The blog itself (with its ugly default template) is installed at http://blog.example.com.
I want to integrate the blog into an existing site, at the URL http://example.com/blog.
I'm doing a mod_rewrite that forwards the entire query string, e.g. http://blog.example.com/?p=7 gets rewritten to http://example.com/blog?p=7.
Now, in my PHP code at http://example.com/blog, I want to do something like this:
query_posts($_GET);
// display results
wp_reset_query();
That's where I'm stuck. Basically, I want to display exactly what's in the "content" area of a default WordPress template, on my site, according to whatever the query string dictates. Almost as if I were just using an iframe. I would rather not have to parse the query string to figure out whether I have to loop through this or that or turn off the $more global or not, etc.
What am I missing?
Instead, should I be installing the blog at http://example.com/blog and creating a template that mimics the website? This seemed complicated so I didn't go this route, but maybe someone should change my mind.
Appreciate any help, including advice for alternative designs.
Have you considered outputting the blog into a full rss/ outputting the blog as json and then pulling it in that way?
I'm using Jumi to echo php code and then showing that in a Joomla Article, and everythings working fine. Now I want to do this:
The output is basically a list from a database like this:
Name Price Type
A 1 T1
B 2 T2
In this list I want to include links to only show items of the same type, so "T1" would like to a page only showing things of type T1. So I thought I would do this by making a new page that takes a type and then get all the items of that type from the database. Without Joomla this wouldv'e been a piece of cake, with Joomla I'm not quite sure where to begin.
How should the a href=... tags in the html code printed by my php script look?
Is my basic structure still correct, and if so, how do I make Joomla open the new page in the normal frame and not replace the whole Joomla page. some kind of target-frame attribute?
EDIT:
I know I should be using a component instead, however I just need to get this working before going on vacation in three days. I will do it properly when I get back.
I don't mind if the entire page reloads, what I do need is the Joomla menu, header-banner and other things around the page to be loaded as well. If I just use a href=mypage.php I assume the header and everything around it will disappear.
I think you are going about this all wrong. You shouldn't be using Jumi to run php in your articles. You should design a component. Although this will take a tiny bit longer to setup initially it will save you time in the long run and prove to be much more flexible than using Jumi in a single article. Have a look here on how to create a Joomla component - http://www.joomladevuser.com/tutorials/components.
a href= tags should not be any different from any other html you have ever used.
E.g. echo 'link';
To make just the frame/div/table/etc reload rather than the entire page you will need to implement some AJAX. I have answered a question on how to do this with Joomla components before, see here: how to use Jquery AJAX in Joomla Components?