Skip to main content

I have a pop up from which I would like to pass page url information as a silent property so that the welcome email can mention that brand ( or even better shopify product vendor information ). Is this possible?

 

Thanks in advance 

Sean

Hi @SeanMcC ,

Thank you for this great question about Sign-Up forms! 

It sounds like what you are looking for is a Hidden Field that would be captured as a user submits the form in order to collect URL. This field is not shown to users on the frontend, but is captured at a Profile level in Klaviyo as a Property, which you can then use to segment the user, or to add a conditional split to your Welcome Series flow in order to send them the most relevant content. 

By default, all new signups have a Source property as a hidden field. This identifies where the profile came. To set up an additional Hidden Field, please follow these steps while in the Form Editor:

  1. Navigate into your button editor
  2. Select +Add a property under SUBMIT HIDDEN FIELDS
  3. Choose an existing profile property or create a new one
  4. Input the value for the property (URL)
  5. Save the button

In a close up of the Hidden Fields section, a second hidden field, URL, has been added with a specific URL as the value

Note: If you add hidden fields that correspond to properties that already exist on someone's profile, they will be overwritten by the new value when someone submits the form.


If you are unfamiliar with Properties in Klaviyo, feel free to check out this guide in the Help Center: Profile properties reference.

You can also reference these other helpful thread on the Community that discuss the use of Hidden Fields and Custom Properties:


--

Hope this helps!

-- Ashley Ismailovski​​​​​​​


@Ashley I. Thansk for the answer, onto it...


Hi, but can the URL be added as a variable?

If the form was on this page, the url would be:
 

 

 

I’m using the same form on several pages but I want the know the URL where the form is completed.

 

Is this possible? How? :)


Thanks

Kind regards,

Tim


Hi there @MisterBarish

 

Thanks for sharing your question with us! 

 

Unfortunately, a dynamic URL can’t be captured on form submission, so it is best to follow @Ashley I.’s superb advice above and having different forms for each page and passing the unique, static URL upon form submission. As the URL will pass as a property, it will be added to their profile and you can segment off of this data accordingly.  

 

Thanks for sharing your question with the Community!

-Taylor


@Taylor Tarpley please consider adding dynamic URL capture on form submission. We have this pop up on all our pages (main page, product pages, blog posts) and we’d love to see where people are signing up. It doesn’t make sense to create a new form for each page


If you’re using Shopify, here are the details you need to capture the URL that a customer was on when they submitted your form.

  1. On your form, click to edit the submit button.  Under “Submit Hidden Fields”, create a new field and set its value.  On this example, I created a Profile Property called “url_visit” and set the Value to “NA”.  Save and publish your changes. 

     

  2. On your Shopify account, go to Online Store > Themes.  Make a backup copy of your theme first.  Then, click on the … next to “Customize” and select “Edit Code”.  Look for and open the file called “theme.liquid”.  On the Theme.liquid file, scroll down to the </body>.  Just above the </body>, paste this code:

<script>
  window.addEventListener("klaviyoForms", function(e) {

  if (e.detail.type == 'submit') {
    var _learnq = window._learnq || d];
    var url_visit = window.location.pathname;
    
      _learnq.push(e'identify', {
        'URL Visited' : url_visit
      }]);
  } // if
}); // addEventListener
</script>

Once pasted, click SAVE in the upper right.

Visit your website and test by filling out your form.  Once the form is filled out, look at your Profile in Klaviyo.  You will see the new information listed under Custom Properties.

If you want to see the URL listed differently, here is a good resource.  Simply look for “pathname” in the Script code above and change it to one of the other variables listed here. https://stackoverflow.com/questions/1034621/get-the-current-url-with-javascript


Hi @rreno,

This script should work regardless of form name and how the signup form is implemented?
I have a embeded form on many different shopify pages in different folders (lanuguage) and i want to identify customers based on the url they used.


@Jakub Yes, the scripts works regardless of the form name.  Make sure your forms have the hidden field url_visited and the pre-defined value of “NA”.  The script will overwrite the pre-defined field with the URL.


Thx @rreno so this not overwrite the url_visit property just use it as trigger and create new one with url value right?
 

 


Thx @rreno so this not overwrite the url_visit property just use it as trigger and create new one with url value right?
 

 

Correct, it only overwrites the value.


@rreno thank you a lot this works great

Just for curiosity can it use one property for example URL Visited so i don't need to create this additional one url_visit?


@Jakub

I see the confusion.  I probably should’ve labeled them differently.

URL Visited is what you should be using in the form(s) in Klaviyo.

url_visit is used on the javascript coding to capture the information from the customer’s browser.
Here is where it is defined “var url_visit = window.location.pathname;”.  This line says to set the variable called url_visit equal to the window path (aka the URL)

I hope that helps.


Just adding here, you should also be able to use Google Tag manager to fire of the event to Klaviyo.

 

Omar Lovert // Polaris Growth // Klaviyo Master Platinum Partner

We help with e-commerce growth through CRO, Klaviyo and CVO


@rreno How can we get dynamic page url as we use wordpress platform and try to get page url using API. Can you please provide script for that?


You can check here is where it is defined “var url_visit = window.location.pathname;”.  This line says to set the variable called url_visit equal to the window path (aka the URL)


Reply