CMS Development

MrCapp
Contributor

URL Parameter Causing Cookie to be Displayed on Page?

SOLVE

On some URL’s for tracking purposes to populate CRM fields on form completions we add ?rd=elb as an example.

We've have never had an issue but this morning it adds visible code to the end of the page.

Any idea what's causing this? If the parameter is removed the page displays normally.

This is what gets injected into the page. When we refresh the page sometimes the code is displayed above the footer, sometimes it's below the footer.

MrCapp_0-1622739306708.png 

MrCapp_0-1622739761861.png

 

 

1 Accepted solution
tjoyce
Solution
Recognized Expert | Elite Partner
Recognized Expert | Elite Partner

URL Parameter Causing Cookie to be Displayed on Page?

SOLVE

@MrCapp - Thank you for the extra information.... I think I was finally able to track down where this code is from (I think).

I'm pretty sure this code as actually custom code that was written for your Google tag manager and the code is placed in the custom code portion of google tag manager

The reason I was asking if it was custom dev or a theme is because the code that is exposed in the webpage follows this tutorial verbatim, which is fine, but I think it might be implemented incorrectly in the google tag manager system....  I also think your code may be missing <script></script> tags around the code as well.

 

When I copy that code out of your website, and run it through a javascript linter, the code ends up appearing incomplete... I see at least 1 missing closing tag on a function and possibly more code after that closing tag is missing.

I highly suspect this is where your issue lives, in the GTM scripts on google's side (see screenshot)

 

Hope that gets to the bottom of it 

 

Image 2021-06-07 at 5.50.20 AM.png

View solution in original post

8 Replies 8
tjoyce
Solution
Recognized Expert | Elite Partner
Recognized Expert | Elite Partner

URL Parameter Causing Cookie to be Displayed on Page?

SOLVE

@MrCapp - Thank you for the extra information.... I think I was finally able to track down where this code is from (I think).

I'm pretty sure this code as actually custom code that was written for your Google tag manager and the code is placed in the custom code portion of google tag manager

The reason I was asking if it was custom dev or a theme is because the code that is exposed in the webpage follows this tutorial verbatim, which is fine, but I think it might be implemented incorrectly in the google tag manager system....  I also think your code may be missing <script></script> tags around the code as well.

 

When I copy that code out of your website, and run it through a javascript linter, the code ends up appearing incomplete... I see at least 1 missing closing tag on a function and possibly more code after that closing tag is missing.

I highly suspect this is where your issue lives, in the GTM scripts on google's side (see screenshot)

 

Hope that gets to the bottom of it 

 

Image 2021-06-07 at 5.50.20 AM.png

MrCapp
Contributor

URL Parameter Causing Cookie to be Displayed on Page?

SOLVE

Thanks for your help with this - I appreciate you taking the time to look it over. I've forwarded the info and we'll see if we can track the problem down.

tjoyce
Recognized Expert | Elite Partner
Recognized Expert | Elite Partner

URL Parameter Causing Cookie to be Displayed on Page?

SOLVE

@MrCapp - I'm thinking this is really simple to solve. Can you please provide a link to the page you have issues on?

MrCapp
Contributor

URL Parameter Causing Cookie to be Displayed on Page?

SOLVE
tjoyce
Recognized Expert | Elite Partner
Recognized Expert | Elite Partner

URL Parameter Causing Cookie to be Displayed on Page?

SOLVE

Thanks @MrCapp - Having a hard time tracking down where this code actually lives... 

Is this javascript code that you or your team created? or do you think it's something that is coming from one of your embed codes for tracking. 

I'm specifically searching your source code of the page for "getCookie" as that's the name of the main function of the code that's being placed as text, but I'm not seeing it in your source.

Might need a little more info on your setup...

are you using a hubspot theme?

do you have custom modules?

etc...

 

Thanks

MrCapp
Contributor

URL Parameter Causing Cookie to be Displayed on Page?

SOLVE

Thanks for taking a look. I'll answer what I can - feel free to ask for more if you need it.

 

Not using a theme - all custom modules.

 

The code seems to be a cookie generated by Google tag manager but I'm not sure how to trace it back to its source. I don't manage that portion of the site but I'm working with people who do so we can make any adjustments suggested.

 

I'll share the code from our site settings to see if that sheds some light on things for you.


Here is the code we have in the site header in our Hubspot settings:

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/aos@2.3.4/dist/aos.css">
<link rel="stylesheet" href="https://use.typekit.net/nnx0rpo.css">
<script src="https://kit.fontawesome.com/0f98a1114a.js" crossorigin="anonymous"></script>
<!-- Google Tag Manager -->
<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-WJDFG8D');</script>
<!-- End Google Tag Manager -->
<meta name="msvalidate.01" content="1E417A5EB5244FEEBBD0E41D1DD7C1DA" />

 

And the footer:

<!-- Google Tag Manager (noscript) -->
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-WJDFG8D"
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<!-- End Google Tag Manager (noscript) -->
<script src="https://cdn.jsdelivr.net/npm/vanilla-lazyload@14.0.1/dist/lazyload.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/aos@2.3.4/dist/aos.min.js"></script>
<script type="text/javascript" async src="{{ get_asset_url('/nu_js/nureva_main.js') }}"></script>

 

I installed the Google Tag Assistant plugin for Chrome and ran it on the page and there were a couple of notices in the report but I'm not sure what to make of them.

I don't think I can attach the PDF so I uploaded it to Dropbox if you want to take a look.

 

Here's the link: https://www.dropbox.com/s/dcsyroicc5sg7ca/gtar.pdf?dl=0

 

Again, if you need anymore info, let me know and I'll send it over.

 

Thanks for your help.

MrCapp
Contributor

URL Parameter Causing Cookie to be Displayed on Page?

SOLVE
We think the issue is related to Google tag manager but not entirely sure how to better diagnose the problem to narrow it down.
0 Upvotes
dennisedson
HubSpot Product Team
HubSpot Product Team

URL Parameter Causing Cookie to be Displayed on Page?

SOLVE

@tjoyce , anything stand out to you here?