【发布时间】:2016-01-12 05:27:44
【问题描述】:
我尝试更改页面的 url 而无需重新加载页面。如果我在控制台中尝试此操作,则 URL 正在更改:
if (localStorage.getItem('product') !== null) {
storedVariable = localStorage.getItem('product');
url = window.location.href;
url += '?product=' + storedVariable;
}
window.history.pushState("", "", url);
但是,当我将此代码放入谷歌标签管理器时,我的页面的 URL 是默认的。我该如何解决?
【问题讨论】:
标签: javascript jquery google-analytics google-tag-manager