Return to Solutions Overview <-

Generate correct utm links for FinSweet's query cms filter

Building a F*n Sweet CMS Filter attributes addition.‍ With this code, you can have a list anywhere on your page that links to a page with a specific pre-filtered list of whatever you wanted filtered ... Basically, this code adds the correct UTM parameters to your CMS list without you having to manually add the correct query links.

(Still under development as of March 15th 2023)

Building a F*n Sweet CMS Filter attributes addition.

With this code, you can have a list anywhere on your page that links to a page with a specific pre-filtered list of whatever you wanted filtered..
.. Basically, this code adds the correct UTM parameters to your CMS list without you having to manually add the correct query links.

Here are pictures to illustrate what this code is doing ->

Before:

You click

And nothing is filtered

After:

You click

It's perfectly filtered

!:

This only works if you set-up the query option in FinSweet's free CMS Filter script.

Here is the code:

<script>
var Webflow = Webflow || [];
Webflow.push(function () { // Run all the code after the site is fully loaded.

  // *** Correct link generator ***

  // Global strings
  const S_DYN_ITEM = '.w-dyn-item'
  const S_NAME = 'h4'
  const S_UTM = 'category'

  // Global elements
  const $_LIST = $('[bmg-category = "list"]')


  // Main function
  $_LIST.find( S_DYN_ITEM ).each(function() {

    let $_link = $(this).find('a')
    let name = $(this)
        .find( S_NAME )
        .text()
        .replace(/ /g, '-')

    let new_link = $_link.attr('href') + '?' + S_UTM + '=' + name

    $_link.attr('href', new_link)
    
  })


}) // The end.
</script>

<span style="opacity:0.35;">(This may not be the version that works perfectly in all corner cases. But it should be good enough for now.)</span>

FAQs

You still have an open question about BMG.studio and how we operate. Chances are good that you will find what you are looking for here:

Why does this FAQ exist?

Well. As of Wednesday, March 15th 2023, I think this component looks really cool.

Can I clone this FAQ component?

Yes. Yes you can. You can do so -> here <-

Still have questions?

It's okay to reach out. Use either email or our calendar tool