Get a single page's URL metric based on its base URL, ignoring the query string - matomo

The hit URL of a single page can be different like /post/15777, /post/15777?fbclid=xxx or /post/15777?rel=notification.
I want to get the URL /post/15777 metric (pageviews) but could not by using the API method getPageUrl in matomo api module because it would think of them as different URL.
GET /?
module=API&format=JSON&method=Actions.getPageUrl&pageUrl=/post/15777&idSite=1&period=range&date=2018-12-12,2019-12-12&token_auth=xxxxxxxxxxxxxxxxxx

Solved
Instead of method Actions.getPageUrl with pageUrl parameter, use the Actions.get method with segment parameter of pageUrl contains a specific url segment=pageUrl=#/post/15777
GET /?module=API&format=JSON&method=Actions.get&segment=pageUrl=#/post/15777&idSite=1&period=range&date=2018-12-12,2019-12-12&token_auth=xxxxx

Related

Use Angular's $location to get URL parameters from URL string instead of current URL

Can I (re)use Angular's $location or another Angular module to get URL parameters from a url? Or do I need to add (yet) another separate JS package to do this?
I have a URL string which I want to get the URL parameters from (aka searchstring). I know there's logic to do this in Angular.js, because $location has the search method. This returns the url parameters part as an object. For instance for a url https://www.domain.org/cool?minPrice=40&maxPrice=50 I can get the maxPrice value using: $location.search().maxPrice.
But this works only for the current url in the browser bar. I'm setting up an ngMock function that has to get url params from a URL passed in as a string parameter. I DON'T want a DIY solution as there is so much debate about what is correct, performant, etc due to things you might not think of it at first like:
- bad performance of regexp
- needing to url encode parameters
- order dependence, etc.
So I'd love to get this gift-wrapped. And ideally as an included-in-Angular solution so there's also no work for wrapping things up in an Angular service :P.
Note: If it's not possible I'll probably use uri.js, which I used to satisfaction in a non-Angular project a while ago.

Fetch data from URL using Angularjs

How to fetch the data from URL and use it. I Have 2 pages where I am redirecting the data from one page to other.
Here is the code for first page:
{{child.name}}
on product.html how do I fetch the URL and the catid data.
If I use $location.path(); it is giving me an error
$location not defined
How do I fetch the information from URL?
If on product.html you are not using angular or any routing mechanism you could always get the current url using the following:
var url = window.location.href;
From here on, you will have to parse the corresponding query string parameters (in your case catid) in order to obtain the desired value. The following thread could give you some example on how to achieve that.

AngularJS: How to provide a search facility and cause route change passing in params?

I need to be able to offer a search facility that will show results, I suppose allowing this route to be be bookmarkable.
What are my options here?
Do I just need to create a new route and place a resolve on there so that i can call my rest service and only display the page when its ready. Then i presume I would force a change of route via my existing controller ?
Problem I see is that I need to store a number of items on the URL, all the search params otherwise it won't be bookmarkable. Is the only way to do this by passing ugly querystrings ?
And how would I access the querystrings from angularjs so i could extract my params that i need to send along to the rest service.
I have tried googling for something similar or an example but I can't seem to find anything.
Has anyone done something similar, any pointers would be really helpful.
thanks
The $location service has a search method that acts as both a getter and a setter for querystring parameters.
It will return an object that corresponds to your parameters:
{
foo:123,
bar:'Kittens'
}

DotNetNuke. How to get current url or ID of page (and frontpage)?

I`m use my custom template. In file CustomTemplate.ascx need to control somethings elements.
If your control inherits from PortalModuleBase you will have a property called "TabId" that will give you the id of the current page.
To get the URL for that page you can use DotNetNuke.Common.Globals.NavigateUrl(TabId);
To get the URL for the homepage, you can use PortalSettings.HomeTabId and the same NavigateUrl Method.
The current Url is also obtained by using the Context.Items("UrlRewrite:OriginalUrl"). This is the Url the page was requested with (which is different to the Request.Url or Request.RawUrl value, which is the rewritten Url.

JsonStore - Load single record with a restful url?

All,
I have a JsonStore backing a form panel in my extjs app. I want to have the jsonStore load a single record based on an id value, but haven't found a good way to do that yet, and still keep the url restful.
My first attempt was to add a param to the jsonstore load() method with the id in it. That only adds the id as a request param, not attached to the url:
http://my-app/users/?id=123
instead of what i want:
http://my-app/users/123
Can someone help me out with this?
You can manually construct the URL that the store uses to query for data (via the implicit HttpProxy it creates for the URL). So your loading function would look like:
function store_refresh() {
json_store.proxy.conn.url = 'http://my-app/users/' + user_id;
json_store.reload();
}

Resources