Send search value after new page load

Silver Contributor
Silver Contributor

Hi community, 

 

# Requirement

i want to track the internal search of a website.

There are two article numbers 12345678 and 12345678k for the same product, the article number with the k is just a distinction, if the customer typed it from the catalog.

This is what we want to track, if a customer typed the article number from a catalog or the website.

 

# Problem

If customer types in the article number in the search field and gets directly to the product page.

Since there is no search page in between there is no query string to parse the search value from. 

 

First idea was to fire a page impression (PI) with KeyUp, SetTimeOut() and Regex.

 

But if the SetTimeOut() is too short, it wont recognize the k and fires the PI withouth a k at the end.

If the SetTimeOut() is too long, it will be broken by the page load of the new site.

 

Is there another idea how to send the search query to Webtrekk, perhaps after the new page load?

 

thank you and greetings

David

4 REPLIES 4

Send search value after new page load

Employee Emeritus

@davidlackovic

The best answer to this question and the one least likely to break is to have your web developer call one of the Tealium tracking functions when the user does a search.  You can read more here:

 

https://community.tealiumiq.com/t5/uTag/utag-link-and-utag-view/ta-p/11888

 

If this is not helpful for your situation, I would encourage you to open a support case as each website is different and the answer to your question is going to be based on how your website is setup.

 

https://community.tealiumiq.com/t5/custom/page/page-id/support-contact-form

Send search value after new page load

Silver Contributor
Silver Contributor

 

thanks Brian for you information.

 

Could it also be done by using a cookie as a storage (persistent data value) and read out the value after the new page load? If not, it have to consider your first answer as the best option.

 

Send search value after new page load

Tealium Employee

@davidlackovic

 

Looking at your site this might be the way forward:

For search tracking:

 

$('#search_id_form').on("submit", function(){
    utag.loader.SC("search", $("#search_id_input").val());
});

To clear the search tracking:

 

if (b["cp.search"]) {
  utag.loader.SC("search","","da"); //Delete the set cookie  
}

At this point you can map "cp.search" toWebtrekk on the next page view.

 

Hope this helps.

 

Adrian

Ask me anything Tealium related or TypeScript/JavaScript, or NodeJS.
Please remember to mark solutions as accepted for future searchers.

Send search value after new page load

Silver Contributor
Silver Contributor

 

 

thank you Adrian, you helped me alot. 

 

 

Public