If you're experiencing problems with your event tracking script not firing properly, especially on thank you or conversion pages, consider the following solutions:
1. Script Loading Order
Issue: The event tracking script may be trying to fire before the main tracking library is fully loaded and initialized.
Solution 1: Push events to a queue before initialization Instead of directly calling the tracking function, use a queue system:
<script>
window.mdq = window.mdq || [];
function queueEvent() {
mdq.push(arguments);
}
queueEvent('track', 'Purchased', {
// Optional attributes
});
</script>
Solution 2: Add a delay to event firing Use setTimeout to delay the event tracking call:
<script>
setTimeout(() => mida.track("Purchased"), 2000);
</script>
Note: Adjust the 2000 millisecond (2 second) delay as needed.
2. Script Placement
Ensure that your main tracking library script is placed before any event tracking scripts in your HTML.
3. Console Error Checking
Always check your browser's console for any JavaScript errors that might prevent the script from firing correctly.
4. Testing and Verification
- Use preview modes in tag management systems to verify trigger conditions.
- Implement test events to confirm the script is working in a controlled environment.
5. Cross-Browser Testing
Test your implementation across different browsers to ensure consistent behavior.
By applying these solutions and best practices, you should be able to resolve most common issues with event tracking script firing. If problems persist, consider reaching out to the support team of your specific tracking solution for further assistance.
Was this article helpful?
That’s Great!
Thank you for your feedback
Sorry! We couldn't be helpful
Thank you for your feedback
Feedback sent
We appreciate your effort and will try to fix the article