0

I'm using glass mapper BeginRenderLink to output some links:

@using (BeginRenderLink(link, n => n.Destination, isEditable: true))
{
    @RenderImage(link, lnk => lnk.LinkIcon, isEditable: true, outputHeightWidth: true)
}

Most of the time this works fine. But in this case I have a link that is an external link that uses a marketing tool called Adjust and the link has query string parameters that contain urls. In particular, one of the urls has Google Analytics parameters in it. So this url:

http://app.adjust.com/6jr6nn_log23f?deep_link=com.somesubdomain.somedomain.rsurlscheme%3A%2F%2Fhttps://somedomain.com&fallback=https%3A%2F%2Fsomedoamin.com%2F%3Futm_source%3DWebsite%26utm_medium%3D03_20_2018%26utm_campaign%3DSOMEDOAMIN.COM

Using BeginRenderLink my second querystring parameter, 'fallback' is getting removed. By process of elimination I am sure it is the ga parameters (utm_source, utm_medium, etc...) that are the source of the problem. Also, if I just spit out an anchor link the url is rendered correctly, so I am sure it is the BeginRenderLink. I would like to continue using BeginRenderLink for Experience Editor reasons.

Why is this getting stripped?

I also looked the Glass code and nothing obvious was leaping out at me.

  • Which version of Glass Mapper are you using? I tried this on the below used references on Packages and versions and it did not strip anything from Glass perspective. <package id="Glass.Mapper.Sc" version="4.3.4.197" targetFramework="net46" /> <package id="Glass.Mapper.Sc.Core" version="4.3.4.197" targetFramework="net46 Also, when you see the HTML, do you see all the query params intact, few things I would check - 1. Any custom pipelines that could be doing it on your Sitecore Instance? 2. This external site if you have access to, may be something on their site is trimming the query params? – Dips Apr 30 '18 at 20:13
0

I tested this in a Sitecore 8.2.4 instance and I don't see Glass Mapper stripping out querystring information when using a General Link field and Glass Mapper's BeginRenderLink. My source looks like this:

 <li>
     @using (Html.Glass().BeginRenderLink(navItem, x => x.Link, new { @class = cssClass }))
     {
         @Html.Glass().Editable(navItem, x => x.Title);
     }
 </li>

If I go to Sitecore and input a General Link that is an external link and input: http://www.custom.com/?deep_link=com.somesubdomain.somedomain.rsurlscheme%3A%2F%2Fhttps://somedomain.com&fallback=https%3A%2F%2Fsomedoamin.com%2F%3Futm_source%3DWebsite%26utm_medium%3D03_20_2018%26utm_campaign%3DSOMEDOAMIN.COM which is similar to your example. If I publish that change and then view source on the page, I see the full querystring in tact.

Example

If you are seeing the same in the view source, than this issue is outside of Sitecore, and more than likely when a user clicks on the link, when the next site loads, it parses the querystring and strips out parts of it. It's possible in fact, that it's stripping out the tracking code because it's seen it and takes it out after storing a cookie from the requested url. Either way, Glass isn't the issue.

|improve this answer|||||
  • It ended up being a bug in Glass. As soon as I updated Glass, it worked fine. – Ethan Schofer May 1 '18 at 20:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.