整个站点中的持久 URL 查询字符串?

这是其中一种情况,我觉得有一个简单的答案就在我面前......希望你们/女孩可以给我亮光.

This is one of those situations where I feel like there is a simple answer right in front of me...hopefully you guys/gals can show me the light.

问题:

我有一个客户想要在他们网站上的所有页面上维护一个查询字符串,只有当他们通过包含查询字符串的链接到达网站时.

I have a client that wants to maintain a query string across all pages on their site, only if they arrived at the site via a link that contains the query string.

此查询字符串还需要与来自站点的任何外部链接一起传递.

This query string would also need to be passed with any external link from the site.

信息:

查询字符串示例:

?utm_medium=&utm_source=

(显然这是为了跟踪广告转化)

(Obviously this is for tracking conversions from ads)

我们目前正在通过 Google Analytics 跟踪所有这些内容(所以,是的,我知道这是一种替代方法),这是为了提供额外的报告层.

We're currently tracking all this stuff via Google Analytics (so, yes, I know that's an alternative), this is for an extra layer of reporting.

我没有为他们的网站编写代码,这带来了它自己的一系列问题(例如:我什至不确定他们在所有页面中都使用了一个共同的标题)-所以我希望有一个 KISS 答案可以解决这个问题.

I did not code their site, which brings it's own set of issues (example: I'm not even sure they use a common header among all pages) - so I'm hoping there is a KISS answer out there for this.

有什么建议吗?

推荐答案

所以 - 这里的答案是这样的:

So - the answer here was this :

  1. 使用JS抓取查询字符串
  2. 验证查询字符串
  3. 添加到 cookie
  4. 将 cookie 查询字符串附加到 DOM 中的每个 href

就像我说的......我知道有一个简单的例子在盯着我看哈哈!

Like I said...I knew there was a simple example staring me in the face haha!

相关文章