My data element is populating on the console log but not when a rule is firing. What can I try to fix? | Community
Skip to main content
Level 3
October 18, 2023
Solved

My data element is populating on the console log but not when a rule is firing. What can I try to fix?

  • October 18, 2023
  • 1 reply
  • 1251 views

I have a data element that captures the Search_Term when users types it in the search bar. The data element is using Core - DOM Attributes: 

 

The rule is triggered via custom events when a user conducts a search action. 

 

When I type in the search bar and use the _satellite.getVar('Search_Term') I get the correct value. However, when the rule triggers, I do not see the search term variable being populated. 

 

Some insight would be appreciated here. 

 

Note - I am also trying a different method to capture the search term from the URL: https://ABC.XYZ.com/search?keyword=Climate (Will update here once I test it out).

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Jennifer_Dungan

"Timing Issue" is the same as "the input box disappearing as soon as the search is performed"... they aren't separate suggestions... It's a "timing" issue because there isn't enough time to get the value before it disappears.

 

 

When you run _satellite.getVar('Search_Term') in your console, it executes the extraction... you didn't initiate the search, the input field is fully available to grab the value from the element....

 

When you are actually performing the search, the the search behaviour takes you from the page where you executed the search to the search results page... it's entirely possible that the input element is not reachable by the time the Data Element attempts to execute and get the value..

 

Without seeing the implementation or the behaviours this is the most likely scenario based on the fact that the Data Element works just fine when not actually submitting the form.

 

You could try to create a rules on "Blur" of the input element.. Holding the value to use on submit (rather than grabbing the value during submit), but if the user submits the form using their enter key, I don't know if this constitutes a "blur" action.

 

Or, you could ask your developers to try adding a short 100-200ms delay after submitting the form and leaving the page to load the results.. this should be small enough not to be noticed by users, but might just allow your original Data Element to succeed in getting the value.

 

I would work with your developers, show them the issue you are having. Work together in a Dev environment to try a few things like adding a slight delay to see if that fixes the problem...

1 reply

Jennifer_Dungan
Community Advisor and Adobe Champion
Community Advisor and Adobe Champion
October 18, 2023

It's possibly a timing issue? Maybe the input box disappears as soon as the search is performed (so the Data Element) doesn't have a chance to populate for the tracking?

 

I also collect from our Search Form, but because we have multiple forms on the page technically (desktop and mobile variants - one being hidden at a time). I actually just extracted the value using custom code based on which form was actually being submitted... 

 

You might have to try something like that?

Level 3
October 18, 2023

I don't believe its a timing issue as the data element is populated before the search event fires. 

 

Since I can already see the correct value using the _satellite.getVar('Search_Term'). 

 

It is most likely the latter - Maybe the input box disappears as soon as the search is performed (so the Data Element) doesn't have a chance to populate for the tracking?

 

what would I be able to do if this is the case? Create a custom code that asynchronously stores the value until the custom event is called.

Jennifer_Dungan
Community Advisor and Adobe Champion
Jennifer_DunganCommunity Advisor and Adobe ChampionAccepted solution
Community Advisor and Adobe Champion
October 19, 2023

"Timing Issue" is the same as "the input box disappearing as soon as the search is performed"... they aren't separate suggestions... It's a "timing" issue because there isn't enough time to get the value before it disappears.

 

 

When you run _satellite.getVar('Search_Term') in your console, it executes the extraction... you didn't initiate the search, the input field is fully available to grab the value from the element....

 

When you are actually performing the search, the the search behaviour takes you from the page where you executed the search to the search results page... it's entirely possible that the input element is not reachable by the time the Data Element attempts to execute and get the value..

 

Without seeing the implementation or the behaviours this is the most likely scenario based on the fact that the Data Element works just fine when not actually submitting the form.

 

You could try to create a rules on "Blur" of the input element.. Holding the value to use on submit (rather than grabbing the value during submit), but if the user submits the form using their enter key, I don't know if this constitutes a "blur" action.

 

Or, you could ask your developers to try adding a short 100-200ms delay after submitting the form and leaving the page to load the results.. this should be small enough not to be noticed by users, but might just allow your original Data Element to succeed in getting the value.

 

I would work with your developers, show them the issue you are having. Work together in a Dev environment to try a few things like adding a slight delay to see if that fixes the problem...