使用谷歌分析进行跟踪活动而无需查询字符串参数?

Emanuele Del GrandeSimon_Weaver提出了一个问题:Track campaigns with Google Analytics without query string parameters?,或许与您遇到的问题类似。

回答者Yahel给出了该问题的处理方式:

_set campaignParams

Your theoretical "_setCampaignData" finally exists, in the form of ["_set","campaignParams",...]

If you have a way to programmatically inject the values you'd like to set (for example, set by a cookie on a redirect, or on the server side and printed onto the page), you can use the _set API to hard-code the campaign params that you'd like to set.

The format for that is just:

------------------ ----------------- 
--------------------------------------------------------------

So, using your original example:

 --- -------------- - --- ----------------------------- ---
 --- -------------- - --- ----------------------------- ---
 --- ------------ - --- --------------------------- ---
 ------------------ ----------------- 
--------------- - ------------ -  -------------- - -------------- --------------- - -----------------

Update 2017

This answer details how to accomplish this with the newer Google Analytics library, analytics.js/Universal Analytics.

希望本文对你有帮助,欢迎支持JavaScript中文网

来源:JavaScript中文网 ,转载请注明来源 本文地址:https://www.javascriptcn.com/post/24887