wistia / fresh-url Goto Github PK
View Code? Open in Web Editor NEWDrop this script on your page and enjoy the freshest of URLs
Drop this script on your page and enjoy the freshest of URLs
I thought that I'd installed it wrong before but later found that it was because of an adblocker.
Is there a way to set this to clear the URL or detect that GA was blocked and fall back to just removing it after the page was loaded?
Hello,
I am using the Wistia Fresh URL on our HubSpot hosted website but it seems to be interfering with the HubSpot analytics. Is there any way of checking for definite whether or not it is interfering? And is there any way to solve it?
I have used to following script to ensure it waits for HubSpot to read the UTM parameters but it doesn't seem to make any difference.
<script> var _freshenUrlAfter = ['googleAnalytics', 'hubspot']; </script> <script src="//fast.wistia.net/labs/fresh-url/v1.js" async></script>Be glad if you could help...
Gavin
Hello,
Thanks for the fresh URL tool. The script delete the UTM tag perfectly well. Unfortunately, I noticed something now. When I place for example banner ads, the visitor lands on the landing page. The UTM tag overright the original referral (UTM example: Source: welt.de, Medium: banner), registered by Analytics and hidden by Refresher. If I now trigger an event that I track via the GTM, the UTM tag will be overwritten and replaced with the original referrer (Original referral: Source: welt.de, Medium: referral). As soon as I disable the UTM refresher, everything works.
Have you ever had such a thing? Thanks for your support.
Best regards
Nino
It would be great if this package were added to the NPM registry so it could be easily included in Webpack bundles.
Thanks!
I think the current regex doesn't include fb's fbclid tracking tag. https://fbclid.com/
Hi,
This is a bit of a random one, but basically there seems to be an issue with Fresh URL not waiting for a couple of analytics scripts to load (namely HubSpot). However, this is only occurring with Twitter ads links - it's not proving an issue anywhere else. So, in HubSpot, new leads coming from Twitter ads are being marked as direct traffic rather than Twitter.
I can't work out why this could be - any ideas?
Happy to clarify further if need be.
Thanks.
Our site is set up to mainurl.com/#childpage
but when the utm parameters show up after the # sign it won't clear.
Ideally if url is like this mainurl.com#childsite?utm_medium=source
the utm parameters would be cleared.
More than cleaning my website urls I would like to clean every other links on the interweb. Do you believe that is plausible to turn this functionality into a browser extension?
I would definitely want to have that on my browser. My eyes would be thankful.
So what I read from this code, a callback function needs to be added to the dataLayer
array. It seems like this callback function is supposed to be called from GA at some time.
The problem is, that function is never called. And I cannot find any references on the web that mention adding a function to that array. Everybody just puts objects in there, with keys and some values.
So none of my script runs in the first place. Can you please explain how this thing starts? I'm only interested in Google Analytics with analytics.js, nothing else.
Here's my code:
window.dataLayer = window.dataLayer || [];
function removeUtmParams() {
console.log("removeUtmParams called");
// Only do this if the browser supports changing the URL of the page
if (window.history.replaceState) {
// Wait for the analytics library to be loaded, or the timeout
let retries = 200;
let pollInterval;
pollInterval = setInterval(function () {
if (retries-- < 0 || window[window.GoogleAnalyticsObject]) {
clearInterval(pollInterval);
// Then push a function onto its queue
console.log("polling completed, retries:", retries);
window[window.GoogleAnalyticsObject](function () {
console.log("cleaning URL");
// Now the tracking is done, clean up the URL
let cleanSearch = window.location.search.
replace(/utm_[^&]+&?/g, "").
replace(/&$/, "").
replace(/^\?$/, "");
let cleanUrl = window.location.pathname + cleanSearch + window.location.hash;
window.history.replaceState(window.history.state, "", cleanUrl);
});
}
}, 50);
}
}
function gtag() {
dataLayer.push(arguments);
}
gtag("js", new Date());
gtag("config", "UA-.....", { "anonymize_ip": true });
console.log("pushing to dataLayer");
gtag(removeUtmParams);
The log says "pushing to dataLayer" and nothing else. The URL is untouched. The page view is tracked in the realtime view.
PS: When I call removeUtmParams
directly instead of adding it to the array, it runs to completion, cleans the URL, but I can't see the source value in the realtime reports. But then again, I can't even see the source in the report when I don't clean up the URL. Strange.
Any chance of supporting Matomo analytics (formerly Piwik)?
Or can anyone share a way of adding in a custom trigger for this?
There seems to be an issue running this with tag manager.
Pardot seems to function just fine.
Hi,
I found your script and I like it, so I tried to use it on our company website. It works fine, but we have noticed that Google Analytics is counting only about 60% of url utm parameters, so I had to put it away. We are inserting analytics code via Tag Manager. I have read whole readme, but didn't find what could be wrong. Do you have any clue?
Thanks
Cleaning up utm_*
, wkey
, and wemail
is nice, but something you want to scrub other params. If we expose a ready
callback for after FreshURL has done its stuff, it would be trivial for a user to do more scrubbing.
Hello,
Is Fresh URL still active and working? I've used it in the past for a couple sites and now I'm having trouble getting it working on a new website. Does anyone have an update or any feedback? Any help would be appreciated.
Thanks!
Drip uses a URL parameter in its email links: __s=abcd3et6spmh2s3io7xy
. The user also includes a drip.js file. I've noticed that Drip automatically cleans up the URL parameter under most circumstances, but I can see in my logs that it isn't always removed. I suspect this may be because the drip.js script is blocked.
Never mind.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.