简体   繁体   English

此代码跟踪GA中的JQM页面。 如何跟踪页面以及查询参数?

[英]This code tracks JQM page in GA. How can I track the page plus the query parameter?

I found this code which tracks pages but I have query parameters too. 我找到了跟踪页面的代码,但是我也有查询参数。

For example, my url may look like page.html#one?d=firstparam&n=secondparam 例如,我的网址可能类似于page.html#one?d=firstparam&n=secondparam

This code tracks the page but I lose the query parameter: 这段代码跟踪页面,但是我丢失了查询参数:

$(document).on('pageshow', '[data-role=page], [data-role=dialog]', function (event, ui) {
    try {
        if ($.mobile.activePage.attr("data-url")) {
            ga('send', 'pageview', $.mobile.activePage.attr("data-url"));         // remove quotes
        } else {
            ga('send', 'pageview');
        }
    } catch (err) {}
});

The code is from this post: jQuery Mobile Google Universal Analytics 代码来自这篇文章: jQuery Mobile Google Universal Analytics

GA will display the page like one but I lose the page.html and the query bits. GA会显示如下的页面one ,但我失去了page.html和查询位。

No code changes (standard GA tracking) gives me page.html and nothing else. 没有任何代码更改(标准的GA跟踪)就没有给我page.html

How can I get the whole: page.html#one?d=firstparam&n=secondparam ? 如何获得整体信息: page.html#one?d=firstparam&n=secondparam

You can try to follow this resource . 您可以尝试遵循此资源 Basically you will need to overwrite the default page by rebuilding it with the information you need when you send the pageview hit. 基本上,您需要使用发送网页浏览匹配时所需的信息来重建默认页面,从而覆盖默认页面。 Be aware that there have been issues, as exposed in this SO post 请注意, 本SO帖子中已公开了一些问题

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM