WordPress website not working after adding Google Tracking Code?

WordPress website not working after adding Google Tracking Code?
I have tried adding code via a plugin and also by manually editing header.php file, but still same issue.

This page isn’t working
www.mywebsite.com.au redirected you too many times.
Try clearing your cookies.
ERR_TOO_MANY_REDIRECTS


<!-- Google Tag Manager  head code-->
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-DGSRS556');</script>
<!-- End Google Tag Manager -->


<!-- Google Tag Manager body code (noscript) -->
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-DGSRS556"
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<!-- End Google Tag Manager (noscript) -->
sabecsAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Britt ThompsonSr. Systems EngineerCommented:
Sounds like you may have something in your .htaccess file causing the invalid redirect loop. Or, another plugin is causing the loop.

If not .htaccess,  you can add the script to the header and disable plugins one by one to see if that's the cause.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Andrei FilonovWeb Developer / OwnerCommented:
Your site seems to be redirecting to https:// version of the domain, and then error is shown about invalid certificate...
Adding google code should not really do anything like that...
Have you turned ON some sort of SSL setting? Changed URL perhaps?
0
Scarlett WhitehouseTechnical WriterCommented:
This problem is not occurring by adding Google Tracking Code. It is your website redirection problem, which can occur due to some modification has been done to your .htaccess file. Changes in .htaccess file can happen due to some redirection plugins which you have installed. So I would suggest you the same as Britt Thompson said disable plugins one by one then add Google Tracking Code to check the issue is resolve or not.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Google

From novice to tech pro — start learning today.