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

Update to allow hashtag paths #17

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

txavier
Copy link

@txavier txavier commented Sep 1, 2017

This line change allows hashtags to appear in url.

This line change allows hashtags to appear in url.
@@ -118,7 +118,7 @@

if ($window._paq) {
$window._paq.push(['setDocumentTitle', $window.document.title]);
$window._paq.push(['setCustomUrl', path]);
$window._paq.push(['setCustomUrl',locationObj.$$absUrl]);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think, this should be optional und be customizable from parent component.

because in https://developer.matomo.org/guides/spa-tracking

matomo use this code-snippet for SPA

var currentUrl = location.href;
window.addEventListener('hashchange', function() {
    _paq.push(['setReferrerUrl', currentUrl]);
     currentUrl = '/' + window.location.hash.substr(1);
    _paq.push(['setCustomUrl', currentUrl]);
    _paq.push(['setDocumentTitle', 'My New Title']);

    // remove all previously assigned custom variables, requires Matomo (formerly Piwik) 3.0.2
    _paq.push(['deleteCustomVariables', 'page']); 
    _paq.push(['setGenerationTimeMs', 0]);
    _paq.push(['trackPageView']);

    // make Matomo aware of newly added content
    var content = document.getElementById('content');
    _paq.push(['MediaAnalytics::scanForMedia', content]);
    _paq.push(['FormAnalytics::scanForForms', content]);
    _paq.push(['trackContentImpressionsWithinNode', content]);
    _paq.push(['enableLinkTracking']);
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants