• Resolved chickendipper

    (@chickendipper)


    Hello,

    I have been trying to get Matomo working with my Word press site that is using an ajax theme.
    The tracking is working, I am using tag manager. But all page views are logged as the homepage instead of the page that is visited.

    I used the following code for google analytics:

    jQuery(document).on('pjax:complete', function() {
      gtag('send', 'page_view');
     });

    So changed this to:

    	
    jQuery(document).on('pjax:complete', function() {
    	window._mtm.push({'event': 'mtm.PageView'});
     });
    

    But still the page views are all tracked as the homepage, please could you help me?

Viewing 14 replies - 1 through 14 (of 14 total)
  • hi @chickendipper

    Here comes a tutorial for the tracking of the ajax websites.
    https://developer.matomo.org/guides/spa-tracking

    You could also try to define a javascript variable and use it for the url in your tag. Then, in your code source, you’ll define this variable with
    _mtm.push({'variable': your_page_url});

    Kind regards

    Mat

    Thread Starter chickendipper

    (@chickendipper)

    Hi,

    I have tried everything in the spa guide before posting with no luck with showing the actual pages viewed.

    To add I did try using the normal tracking code before switching to tag manager. I only tried tag manager as I thought it may work using history change for example.

    My js knowledge isn’t great. Would it be a complex task to create a js variable to use it for the url in the tag?
    Not sure I fully understand this.

    Thank you.

    • This reply was modified 2 years, 9 months ago by chickendipper.

    Hi @chickendipper

    No it’s easy: in matomo tag manager create a new variable of type custom javascript and called it MyPageUrl for example.
    In your page view tag replace the content of your page url by your MyPageUrl variable.
    Then, in your source code, set the content of this variable by using the following code:
    _mtm.push({'MyPageUrl': your_page_url});

    Kind regards

    Mat

    Hi @chickendipper

    Any chances you read my previous comment?

    Kind regards

    Mat

    Thread Starter chickendipper

    (@chickendipper)

    Hello,

    Sorry for the delay, I did and I also tried this but still have had no luck.

    I had given up to be honest, as much as I would like to use Matomo it still tracks all page views as the index of the site unless you manually refresh while on a page.

    If there is anything else I could try please let me know.

    Thanks.

    Hi @chickendipper

    What are you not able to do?

    Thread Starter chickendipper

    (@chickendipper)

    Hi,

    I still cannot get page views to track, every page view is the homepage when I know it is not while testing.

    I have also tried as you suggested and it still isn’t working unfortunately ??

    Hi @chickendipper

    Are there any chances you share with us the pages where this is not working?
    You can share them here or at [email protected]

    Kind regards

    Mat

    Hi @chickendipper

    Without any answer I close this topic.
    Feel free to open a new one if you require further assistance.
    Kind regards

    Mat

    Thread Starter chickendipper

    (@chickendipper)

    Hello,

    Sorry I didn’t respond, I am not going to open a new thread to re-explain the issues so I re-open this thread. ??

    I have sent a link to my site to [email protected] to see if you can see any issues.

    Thanks for the help!

    Hi @chickendipper

    Did you find someone to assist you?
    Can I close this topic now?
    Kind regards

    Mat

    Thread Starter chickendipper

    (@chickendipper)

    Afraid not.

    “It’s difficult to help you as your javascript is minified.
    I would suggest you to hire a frontend developer to help you to set up the tag plan.”

    Not really looking to hire someone to use a free plugin though ?? I could unminify the js quite easily.

    Hi @chickendipper

    You should be able to achieve what you want if you follow our documentation.
    Sorry but setting up a tag plan is out of this support scope.

    Kind regards

    Mat

    Thread Starter chickendipper

    (@chickendipper)

    I never wanted to setup a tag plan. Never asked for you guys to setup a tag plan.
    Just wanted to use Matomo in its simple default setup?

    Looks like I will be sticking with Google Analytics.

Viewing 14 replies - 1 through 14 (of 14 total)
  • The topic ‘Tracking ajax page load’ is closed to new replies.