Where to store a library of custom information to display with HubL


#1

Hello. We have a pretty elaborate way to display our sales reps information on our website using a UTM in the URL.

https://info.merchantproexpress.com/professional-associations?rep_first=jon&rep_last=sasala

If this rep_first rep_last is not in the URL it then looks to see if the visitor has an owner. If either are true, that reps information is displayed in the upper right and anyone who converts anywhere on the site will be assigned to that rep. If they post these links to social, anyone not in the database that then converts gets assigned to them. This is our way of encouraging reps to share our blog content or landing pages.

Everything works swimmingly. The issue I have is the code to make this all work is right now being stored in the site header. As the list of reps grows I am sure this is going to slow down load time. My question is this: is there a better place I should save this growing library so the info gets loaded but it does not slow down the site? It could be in the theme templates somewhere above the navigation but there might be a better coding way to do this, maybe in the CSS (didn’t work) or in some type of Javascript file.

Thanks in advance.

My code if you were curious:
{% set rep_first_sanella_martensson = “Sanella” %}
{% set rep_last_sanella_martensson = “Martensson” %}
{% set rep_email_sanella_martensson = "smartensson@mpxusa.com" %}
{% set rep_title_sanella_martensson = “Payment Specialist” %}
{% set rep_phone_sanella_martensson = “516-422-7485” %}

{% set rep_first_ernest_burt = "Ernest" %}
{% set rep_last_ernest_burt = "Burt" %}
{% set rep_email_ernest_burt = "e.burt@mpxusa.com" %}
{% set rep_title_ernest_burt = "Payment Specialist" %}
{% set rep_phone_ernest_burt = "732-546-0080" %}

{% set rep_first_reno_mccall = "Reno" %}
{% set rep_last_reno_mccall = "McCall" %}
{% set rep_email_reno_mccall = "r.mccall@mpxusa.com" %}
{% set rep_title_reno_mccall = "Payment Specialist" %}
{% set rep_phone_reno_mccall = "601-927-5799" %}

{% if request.query_dict.rep_first %}

{% set rep_first = "{{ rep_first_"~request.query_dict.rep_first~"_"~request.query_dict.rep_last~"|default('MerchantPro Express') }}" %}
{% set rep_last = "{{ rep_last_"~request.query_dict.rep_first~"_"~request.query_dict.rep_last~"|default('') }}" %}
{% set rep_title = "{{ rep_title_"~request.query_dict.rep_first~"_"~request.query_dict.rep_last~"|default('') }}" %}
{% set rep_phone = "{{ rep_phone_"~request.query_dict.rep_first~"_"~request.query_dict.rep_last~"|default('888-333-1374') }}" %}
{% set rep_email = "{{ rep_email_"~request.query_dict.rep_first~"_"~request.query_dict.rep_last~"|default('info@merchantproexpress.com') }}" %}
{% set rep_photo = "{{ rep_photo_"~request.query_dict.rep_first~"_"~request.query_dict.rep_last~"|default('') }}" %}

{% elif owner %}

{% set rep_first = "{{ rep_first_"~owner.firstname|lower~"_"~owner.lastname|lower|cut("'")~"|default('MerchantPro Express') }}" %}
{% set rep_last = "{{ rep_last_"~owner.firstname|lower~"_"~owner.lastname|lower|cut("'")~"|default('') }}" %}
{% set rep_photo = "{{ rep_title_"~owner.firstname|lower~"_"~owner.lastname|lower|cut("'")~"|default('') }}" %}
{% set rep_phone = "{{ rep_phone_"~owner.firstname|lower~"_"~owner.lastname|lower|cut("'")~"|default('888-333-1374') }}" %}
{% set rep_email = "{{ rep_email_"~owner.firstname|lower~"_"~owner.lastname|lower|cut("'")~"|default('info@merchantproexpress.com') }}" %}
{% set rep_title = "{{ rep_title_"~owner.firstname|lower~"_"~owner.lastname|lower|cut("'")~"|default('') }}" %}

{% else %}

{% set rep_first = "MerchantPro Express" %}
{% set rep_phone = "888-333-1374" %}
{% set rep_email = "info@merchantproexpress.com" %}
{% endif %}

#2

Hi @JonSasala,

It sounds like this might be a good use case for a HubDB table. Using HubDB, you could store each rep as a row in a table, and loop through each rep until you find the one that matches your query parameters. Check out the HubDB documentation below: