New profile feature for registration not handling gtag script correctly

1 year 2 months ago - 1 year 2 months ago #332622 by petekuhn
Running Joomla 4.2.6, CB 2.8.0+build.2023.01.27.16.59.55.3636e2d5a, CBSubs 
4.6.1+build.2023.01.18.18.35.11.074602ba8

The registration header has the following at the beginning:
<!-- Event snippet for Website traffic conversion page -->
<script>
    gtag('event', 'conversion', {
        'send_to': 'XXXXXXX'
    });
</script>

The page displayed shows the script (see screenshot) 
Attachments:

Please Log in to join the conversation.

1 year 2 months ago #332628 by krileon
Looks like you were putting JavaScript inside of the registration header. This wasn't allowed, but wasn't prevented before. The header and footer safely escape to safe HTML now. You should be adding custom JS to the page using CB Auto Actions or other safe methods to insert JS. The below CB Auto Actions usage can safely insert your custom JS.

Global
Triggers: onAfterRegisterFormDisplay
Type: Code
User: Self
Access: Everybody
Action
Method: JavaScript (Inline)
Code:
gtag('event', 'conversion', {
    'send_to': 'XXXXXXX'
});


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.
The following user(s) said Thank You: petekuhn

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.392 seconds

Facebook Twitter LinkedIn