• Hey,

    I’ve noticed that Google Analytics is tracking a big drop in page views, but not in sessions. I’m wondering how to make AjaxLoadMore is tracking a new pageview each time a story is loaded in my example site.

    We have the google analytics tracker in our header.php file but I saw in the settings that it says “Must have a reference to your Google Analytics tracking code on the page.” Does that mean I need to put the tracker inside of the single.php file or do I need to add it into the repeater template?

    Thanks for your time.

    The page I need help with: [log in to see the link]

Viewing 9 replies - 1 through 9 (of 9 total)
  • Thread Starter markelrayes

    (@markelrayes)

    Just bumping this.

    Plugin Author Darren Cooney

    (@dcooney)

    @markelrayes Sorry, missed this one.

    You can add the following hook to trigger a console.log after a page view has been sent.

    add_filter('alm_ga_debug', function() {
    	return true;
    });

    Let me know if this helps.

    Thread Starter markelrayes

    (@markelrayes)

    Should I just paste that into function.php? I’m guessing it show show True inside the console log after I do…

    Plugin Author Darren Cooney

    (@dcooney)

    Yes, functions.php

    It should say, Ajax Load More: Page View sent to Google Analytics

    Or something similar. I can’t remember 100%

    Thread Starter markelrayes

    (@markelrayes)

    Yeah it’s not logging.

    Here is the code I used

    if ($marketfilter == 'story-market') {
    			echo do_shortcode('[ajax_load_more single_post="true" single_post_id="' . get_the_ID() . '" single_post_order="query" single_post_query_order="latest" repeater="template_6" post_type="stories" meta_key="story_market' . ($filtertopics ? $filtertopicstax : NULL) . '" meta_value="' . $market . ($filtertopics ? $filtertopics : NULL) . '" meta_compare="=:LIKE" meta_relation="AND" meta_type="CHAR:CHAR" scroll_distance="-500" posts_per_page="1" taxonomy="' . ($filtermarkets ? $filtermarketstax : '') . ($filtermarkets & $filtersectors ? ':' : '') . ($filtersectors ? $filtersectorstax : NULL) . '" taxonomy_terms="' . ($filtermarkets ? $filtermarkets : NULL) . ($filtermarkets & $filtersectors ? ':' : '') . ($filtersectors ? $filtersectors : NULL) . '" taxonomy_operator="IN:IN" cache="true" cache_id="market-stories-' . $market . '" seo="true"]');
    		}'

    and here is a sample page:

    https://www.connectcre.com/stories/savills-acquires-workplace-solutions-advisor-t3/

    Thread Starter markelrayes

    (@markelrayes)

    Giving a little bump :]

    • This reply was modified 3 years, 9 months ago by markelrayes.
    Plugin Author Darren Cooney

    (@dcooney)

    Are you using GTM or Google Analytics?
    GTM does not integrate.
    https://connekthq.com/tracking-virtual-pageviews-google-tag-manager/

    Thread Starter markelrayes

    (@markelrayes)

    We are using Google Site Tag. Do you know if I can use the solution above since they are the same framework or do you have a better suggestion?

    Plugin Author Darren Cooney

    (@dcooney)

    Im not sure, sorry. I’ve never used Google Site Tag before. I’d need to take this away and find some time to investigate.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Google Analytics Code’ is closed to new replies.