Custom Behavioral Event is showing completions before I deployed the code to the prod site.
Hey!
I created a custom behavioral event called "Email Capture".
Hubspot gave me a code snippet like this to execute on my site whenever a user performs this action.
```
var_hsq = window._hsq = window._hsq || [];
_hsq.push([
'trackCustomBehavioralEvent',
{
name:'pe123456789_email_capture',
properties: {
// this is optional and you don't have to put anything here
// give each property a value so we know what they mean
options
},
},
]);
```
However I have not deployed this code to my production site yet. It's only on my local site. But I'm seeing thousands of "completions" ever since I created this custom behavioral event in the hubspot UI under Reports > Analytics Tools > Custom Behavioral Events. Why is this event reporting completions when I haven't deployed my custom usage of this code snippet to the prod site yet?
Custom Behavioral Event is showing completions before I deployed the code to the prod site.
Oh it's because when I added that script is wrapped it in a `if (true)` so it fires on every page hit. Why? I didn't know it would do that. How do I make that stop so I can only fire this event from meaningful places in my custom code?
```
// 'true' tracks this event on every page view if (true) { _hsq.push([ 'trackCustomBehavioralEvent', { name: 'pe123456789_email_capture', properties: { // give each property a value so we know what they mean }, }, ]); }
Custom Behavioral Event is showing completions before I deployed the code to the prod site.
I was having the same issue and I managed to get this to not fire by removing all the code in that snippet and firing it manually within my application or via GTM. There is a message below the code box but it isn't clear in my opinion and sounds like if you you remove this code the event won't be valid and any manual attempt won't work.
Also... annoyingly if you remove all the code from the code block you can't hit the "Done" button on the editor. Something has to be in the box to get the "Done" button to be clickable. I just added a space. I guess a comment would also work.