Skip to main content
Question

How Do I Extract UTM from a URL AND have a default value when UTM is not present?

  • October 3, 2022
  • 3 replies
  • 240 views

So I need to extract UTM from a url however in my case it is essential that when there is no UTM a default value is returned, the first part was answered below, but the second wasn’t and I can’t run it without the default value. Can anyone help me?

 

 

This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

3 replies

Troy Tessalone
Zapier Orchestrator & Solution Partner
Forum|alt.badge.img+14
  • Zapier Orchestrator & Solution Partner
  • October 3, 2022

Hi @My Debt Plan Ltd 

Good question.

The Code step logic would need to be updated to include checks if a UTM parameter value exists, and if no, then the default value to set.


GetUWired
Forum|alt.badge.img+12
  • Zapier Solution Partner
  • October 4, 2022

@My Debt Plan Ltd 

To add to Troy’s answer. You can add || after the variable declarations and javascript will use the default value if the url param doesn’t exist

 

 


Thank you so much looking forward to putting this to the test