Parsing a url for UTM parameters

I’m using a text parser to extract UTM parameters from a URL, including utm_source, utm_medium, utm_campaign, camp_name, camp_keyword, and gclid. However, I’m having trouble with camp_keyword, which has the value animated%20video%20making%20companies. I need to retrieve this value as animated video making companies, but I’m not sure how to do it.

Hi @Ace_Automate,

You can use the decodeURL() function to decode the string:

Cheers,
Henk

Hi @Henk-Operative,

How can I use the decodeURL() function? Where should I add it to properly decode the URL?
image
image

Like this:

https://www.make.com/en/help/functions/string-functions#decodeurl--text-

I’m using the regex (?:camp_name|camp_keyword|gclid)=([^&\s]*) to extract values from the URL https://mmtest.mysterymonks.com/contact-us/?utm_source=Google&utm_medium=Search&utm_campaign=Core%20KWDs%20Phrase%20-%20Target%20CPA&camp_source=PaidSearch&camp_name=PhraseMatch_Primary&camp_adgroup=&camp_campaignid=11867203171&camp_adgroupid=134017926676&camp_creative=651854003649&camp_matchtype=p&camp_placement=&camp_targetid=kwd-619691078838&camp_network=g&camp_keyword=animated%20video%20making%20companies&camp_device=c&camp_extra=&gad_source=1&gclid=Cj0KCQjwiuC2BhDSARIsALOVfBJ1TEG6AQauj. While the regex correctly matches all values on regex101, in my implementation, it only retrieves the value for camp_name and not for camp_keyword or gclid. Could you help me understand why this might be happening?

I’m sharing the blueprint of my scenario for which i have tried everything within my understanding, but I still couldn’t achieve the desired output.
blueprint.json (33.8 KB)

It is possible that Make only returns the first match (I am not sure, didn’t test it). The regex you are using is designed to match one of the parameters and extract the value, but it is OR and OR and probably doesn’t return all occurrences. Make does this differntly than regex101.

You can’t alter how the system processes matches directly in Make, but you can still capture all values by designing your regex to explicitly grab each target in separate groups.

You could modify the regex to explicitly target each parameter separately, and then you can use multiple regexes in Make, each designed for one specific field. For example:

•	Regex for camp_name: camp_name=([^&\s]*)
•	Regex for camp_keyword: camp_keyword=([^&\s]*)
•	Regex for gclid: gclid=([^&\s]*)

Cheers,
Henk

@Henk-Operative, I’ve achieved the desired output; the issue was that I needed to use an array aggregator to make it work.

Thanks for your help man. :grin:

3 Likes