Block external site using Google Analytics UTM variables to link to my website

I noticed an external website is linking my website using UTM variables.

I was wondering if there is anyway to block this kind of activity?

I don’t want to see Campaign names created by any ewebsite without my approval.

Many thanks.

Not sure exactly what you are asking for.

If you are looking to deny that information to Google Analytics, I’m not sure if that can be done.

If you are looking to deny access to your website from any user that has those URL params (or UTM variables) in the string, you can do it as long as the user has JavaScript enabled.

Get a list of all the current UTM variable names (like “utm_source”, etc.) and put them into a comma-delimited list. You can then put that list into an array by using split(‘,’).

Loop through that array (or use a for/each) checking the indexOf() of that value in the document.URL. If the index is greater than -1, redirect to another URL like https://www.google.com, or even disney.go.com, or some such.

HTH,

:slight_smile:

Hi WolfShade, I found that the only way that this can be done is using filters in Google Analytics.

This way, if an external site links mine spamming me with different campaign names, I can block them.

Thanks

1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.