Reputation: 59
I have a problem with a wordpress site with elementor pro that I can't solve.
Objective:
When the person comes from a Google Ads UTM a specific popup appears with the Google Ads Form, if they come from organic another popup opens with another form.
Specifications / Elements:
Wordpress site with the Pro element, and popups from the element itself.
2 different popups, each with a specific form.
What was done:
document.addEventListener("DOMContentLoaded", function() {
getURLParameter(name) {
return new URLSearchParams(window.location.search).get(name);
}
const utmSource = getURLParameter('utm_source');
// IDs dos popups no Elementor
const popupGoogleId = "19330"; // ID do popup para Google Ads
const popupOrganicoId = "16228"; // ID do popup para tráfego orgânico
// IDs dos formulários do Gravity Forms
const formGoogleId = "38"; // ID do formulário para Google Ads
const formOrganicoId = "19"; // ID do formulário para tráfego orgânico
// Exibir o popup correspondente com base no parâmetro UTM
if (typeof elementorPro !== "undefined" && elementorPro.modules.popup) {
if (utmSource === 'google_ads') {
// Abre o popup para Google Ads
elementorPro.modules.popup.showPopup({ id: popupGoogleId });
} else {
// Abre o popup para tráfego orgânico
elementorPro.modules.popup.showPopup({ id: popupOrganicoId });
}
}
});
Any idea what else could be done?
Upvotes: -1
Views: 56