Rich-text Reply

Ajax / URL Targeting

Caroline 12-01-16

Ajax / URL Targeting

I've made an experiment that loads a banner according to keywords that a user inputs into one of the search fields anywhere on the website. 

 

It's working everywhere, except for on this page - link below. There is a timing issue, and when using the main search on that page, and when the user writes "München" in the second box (the "Where" or in German "Wo" box) and clicks "Search", nothing changes. But if you refresh that exact link, then the experiment activates and/or identifies the parameters correctly and loads the big banner three rows down on the listings.

 

https://www.ausbildung.de/suche/?utf8=✓&q=&ort=münchen&radius=20&apprenticeship_types%5B%5D=&apprent...

 

 

I'm really a beginner with javascript. When I create a second experiment which would activate the main experiment upong ajaxcomplete, it still only (seemed) to work after refreshing the URL. Basically, I had created a bootstrap experiment with this code:

 

//ajaxComplete:
$(document).ajaxComplete(function() {
window.optimizely.push(["activate", 7942780601]);
});

 

 

 

Certifications, Optimizely
Level 3

RyanC 12-05-16
 

Re: Ajax / URL Targeting

I would push the event on clicking the search button, something in the lines below:

$('.fa-search').click(function(e) {
window.optimizely.push(["activate", 7942780601]);
});
Ryan
------------------------------------------------
The best solution is the simplest.
Level 11