Handlebars - Best practice to handle UTM parameters

132 Views Asked by At

The entire project is based on Handlebars (using HTML, css and JS). I have a footer components that contains all the pages in my website (about, terms of service etc...).

When someone clicks on one of my campaigns (google ads for example), the URL to the homepage looks something like: www.mysite.com?utm_source=Google&utm_term=...&...

which indicates the source of the user.

On some pages, I have a form for leaving an email so I can contact the user in the future, this form is a specific component (contact.hbs). When submitting an email, I append the UTM query parameters and handle them internally (sending myself internal emails, for example).

I want that every form will contain those UTM parameters that originated in the homepage.

What is the best practice to handle those parameters?

I tried to save the in local storage and pass them with every link to a page containing a form that the user clicks, but it is not working using handlebars.

I was thinking that there must be a way to handle this internally, but I'm not sure exactly how.

0

There are 0 best solutions below