- TLC Home Home
- Discussions Discussions
- Documentation Documentation
- Knowledge Base Knowledge Base
- Education Education
- Blog Blog
- Support Desk Support Desk
Hello, I would like to code an extension such as under a certain condition, it will change the base_url, otherwise it will block the ga4 tag from firing.
I don't know what to write in the "else" statement
var ga4_tag_id = 4; if(b['visitor_customer_id'] && utag.sender[ga4_tag_id]){ u.data.base_url = "new_url" } else{ ... }
07-05-2023 04:58 AM
In the "else" statement, you can write the following code:
utag.sender[ga4_tag_id].enabled = false;
This code will disable the GA4 tag from firing.
Here is an explanation of the code:
Here is the complete code:
var ga4_tag_id = 4; if(b['visitor_customer_id'] && utag.sender[ga4_tag_id]){ u.data.base_url = "new_url" } else{ utag.sender[ga4_tag_id].enabled = false; }
I hope this helps! Let me know if you have any other questions.
Copyright All Rights Reserved © 2008-2023