Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

piwik.js: Wildcard support in piwik_hosts_alias #5561

Closed
zawadzinski opened this issue Mar 13, 2008 · 9 comments
Closed

piwik.js: Wildcard support in piwik_hosts_alias #5561

zawadzinski opened this issue Mar 13, 2008 · 9 comments
Labels
Enhancement For new feature suggestions that enhance Matomo's capabilities or add a new report, new API etc.
Milestone

Comments

@zawadzinski
Copy link
Contributor

Now you can specify in javascript code before including piwik.js your site domain aliases:

piwik_hosts_alias = [ “hostname1.com”, “hostname2.com”, … ];

For some site configurations we need to support wildcards so you can specify hostname like:

*.hostname.com
Keywords: piwik.js

@anonymous-matomo-user
Copy link

This feature is a must have for our community sites.

Each of our members have their own url (eg. kofl.devcon5.cc), so without wildcard support piwik would not be useable for us.

We hope the feature will be implemnted soon.

@robocoder
Copy link
Contributor

Attachment: proposed patch
[wildcard.diff](http://issues.piwik.org/attachments/5561/wildcard.diff)

@robocoder
Copy link
Contributor

In my patch (which doesn’t use regular expressions), wildcards are specified in a separate variable.

Usage example:

piwik_hosts_alias = [ “example.com” ]; /\* matches only example.com /
piwik_wildcard_hosts_alias = [ “.example.com” ]; /
matches *.example.com but not example.com */

@mattab
Copy link
Member

mattab commented Jan 14, 2009

Anthon, thanks for your patch. we would like to minimize complexity and no of variables involved. I suggest that we don’t use regular expressions, but that the user can specify the domains in the same array piwik_hosts_alias with the notation *.domain.com

In the JS, you could look for the character \* using substring and apply the same algorithm found in your patch.

Also, we have this test folder: https://github.com/piwik/piwik/blob/master/misc/testJavascriptTracker
that we use for testing the javascript tracking code.
Could you please add a test case?

@robocoder
Copy link
Contributor

Attachment:
[wildcard.2.diff](http://issues.piwik.org/attachments/5561/wildcard.2.diff)

@robocoder
Copy link
Contributor

Attachment includes tests added to page2.php, and rolls-up the piwik.js patches from #141 (revised per matt’s comments), #248, and #351.

@mattab
Copy link
Member

mattab commented Feb 11, 2009

thanks for patch vipsoft; see 887

I updated documentation in the [javascript tracking page](http://piwik.org/docs/javascript-tracking/); please let me know if this is accurate.

Consider a host an alias host and not record the links to this domain as outlinks

By default all links to domains other than the current domain are considered outlinks. If you have multiple domains and dont want to consider links to these websites as outlinks you can add this new JavaScript variable. There is a support for wildcard, if you want to ignore all clicks to subdomains of a specific domain.

[…]
piwik_url = http://yourwebsite/piwik/piwik.php;
piwik_hosts_alias = [“hostname2.com”](“*.hostname1.com”,); // the current tracked website is added to this array anyway
piwik_log(piwik_action_name, piwik_idsite, piwik_url);
[…]

@robocoder
Copy link
Contributor

Wiki docs update looks good.

@zawadzinski zawadzinski added this to the RobotRock milestone Jul 8, 2014
@kramer65
Copy link

kramer65 commented Oct 4, 2018

@robocoder @zawadzinski
I need exactly this. Was this ever merged? Is this supported in the current version?

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement For new feature suggestions that enhance Matomo's capabilities or add a new report, new API etc.
Projects
None yet
Development

No branches or pull requests

5 participants