10 Best ChatGPT Prompts For WordPress Website Marketing Navigating the world of WordPress marketing can be a daunting challenge, especially if you’re new to the platform. That’s why we’ve compiled a list of the 10 Best ChatGPT Prompts specifically geared toward WordPress Marketing. These prompts offer targeted guidance on everything from SEO and content marketing […]
10 Best ChatGPT Prompts For WordPress Marketing Read More »
jQuery(document).ready(function($) {
// Track conversions
$('form[name="wptrack-optin"]').submit(function(e) {
e.preventDefault();
alert("nav");
var form = $(this);
var email = form.find('input[name="form_fields[email]"]').val();
var currentPageUrl = window.location.href; // Get the URL of the current page
var referrer = document.referrer; // Get the referrer URL
$.ajax({
type: 'POST',
url: wp_track_it_ajax.ajaxurl,
data: {
action: 'wp_track_it_track_conversion',
email: email,
pageUrl: currentPageUrl,
referrer: referrer
},
success: function(response) {
// Handle success (if needed)
// form.off('submit').submit();
},
error: function(xhr, status, error) {
// Handle error (if needed)
}
});
});
function trackOutboundLinkClicks(event) {
event.preventDefault(); // Prevent the default action of the link click
var link = event.target.closest('a');
var href = link.getAttribute('href');
//alert(href);
console.log(link);
if (link && link.hostname !== window.location.hostname) {
//alert("here");
// Add your code to track outbound link clicks here
// For example, you can make an AJAX request to log the click
$.ajax({
type: 'POST',
url: wp_track_it_ajax.ajaxurl,
data: {
action: 'track_outbound_link_click',
link: href,
pageUrl: window.location.href
},
success: function(response) {
var redirectUrl = response.data.redirectUrl;
if (redirectUrl) {
if (link.getAttribute('target') === '_blank') {
// If target="_blank", open in a new window
window.open(redirectUrl, '_blank');
} else {
// Otherwise, open in the same window
window.location.href = redirectUrl;
}
// Redirect to the outbound link URL after a delay
// window.location.href = redirectUrl;
}
},
error: function(xhr, status, error) {
// Handle error (if needed)
}
});
} else {
window.location.href = href;
}
}
// Attach event listener to all links within the single post body
document.querySelectorAll('a').forEach(function(link) {
link.addEventListener('click', trackOutboundLinkClicks);
});
});