How to add a button that allows you to pass URL query strings?

  • 4 October 2021
  • 3 replies

Badge +1
  • Contributor I
  • 0 replies

We’ve added a popup that will redirect visitors to the correct shop based on their location. We’ve noticed that URL query strings are being dropped when being transferred to the other shop.


For example, a visitor arrives at our Canadian site with referral link:

If they are an international customer, they will receive a popup message to redirect them to our international site, Once they are redirected, the referral link gets lost and is no longer tracked.


Instead, we want: on our Canadian shop, to get redirected to on our US shop. URL string ?ref=skxtBA, is maintained.


Is this possible?




Best answer by alex.hong 15 October 2021, 21:17

View original

3 replies

Userlevel 7
Badge +58

Hi @Elie,

Welcome to the Community! Thanks for asking your question here :)

I see you are trying to keep a referral link as part of a URL when a customer is redirected from a page? Are you possibly using a custom built integration? If the initial referral link + redirect button are being sent out from Klaviyo, we would need to take a deeper look into your account to see where and how this data is presented and stored. Ultimately, we need to look at the button in the email template that directs the customer to the first to troubleshoot why the link isn't working properly. I would recommend reaching out to support for better assistance and troubleshooting for similar problems to this. In addition, I have created a support ticket already for you and hope you hear back soon.


Please keep us updated with what the fix was as we would all love to learn together!


Userlevel 7
Badge +58

Hi @Elie! Just wanted to follow-up here as I saw that you are now working with a support rep! If you had any further questions, I would recommend staying in touch with Support as they are going to be better suited to address this. But please keep us informed on the Community with any solutions you have found! 



Userlevel 7
Badge +58

Hey there to those that find this post and are looking for a solution!

Just wanted to follow-up with everyone on why this issue may occur with having the referral link not past through.

When Klaviyo JavaScript is installed, the cookie __kla_id tracks when someone clicks through a Klaviyo email and is redirected to your website. You can find our information on this here: About Cookies in Klaviyo

When you go to a site for example in Canada with a referral link, it will show as you are not cookied in your US site when clicking the link despite cookie-ing myself on the CA site. 

Klaviyo cookies visitors when they have:

  • signed up using a Klaviyo-made form

  • clicked into your site from a Klaviyo email

  • added  ? to the URL

  • started a checkout and entered email into field

  • been identified via a Javascript Identify API request (through Klaviyo's Identify API)

Essentially, since the redirect is happening between what Klaviyo sees as two different websites and across two different Klaviyo accounts, the cookies and cached information up until they were identified would most likely be encrypted until they take one of the above actions on the site they were redirected to be identified there.

A workaround that I have seen is to create multiple Klaviyo accounts for multiple locations.

By doing this, you can use referral links and track data among different countries!


Hope this helped!