Rich-text Reply

Targeting a Button / Event

Caroline 12-01-16

Targeting a Button / Event

Hello Everyone, 

I'm having a really difficult time targetting the big search button in order to conditionally activate an experiment from an action associated with the big orange "suchen" button on this page:

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

 

I've tried nested targetting, different class names - but nothing will active my test. These are a few I have tried:

 

 

$('.submit').click(function(){
window.optimizely.push(['activate', 7965561117]);
});

 


$("form").submit(function () {
window.optimizely.push(['activate', 7965561117]);
});

 

 

$("form").submit(function () {
window.optimizely.push(['activate', 7965561117]);
});

 

$("form").submit(function () {
console.log(’test’);
});

 

Admittedly I am not a javascript developer, but I've done a couple of these before. Could anyone come up with an idea as to why none of them are working or something else to try? thanks a lot! 

Certifications, Optimizely
Level 3

CouchPsycho 12-02-16
 

Re: Targeting a Button / Event

Hi,

there is no experiment running on that page. I just added two listeners like you did via the console and they where triggered.

Is that experiment already running but not activated?
What do you expect to happen?

There might be an issue with event-listeners attached to the same button via another script...

Kind regards

Michael



"the essence of the creative act is to see the familiar as strange." (anonymous)
Caroline 12-02-16
 

Re: Targeting a Button / Event

Hi CouchPyscho,
Oh, sorry I think "München" or another of the keywords must be in the input fields.
Like on this page:

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

The ultimate goal is to create a workaround, which activates manually an experiment which will make a banner image appear in the third row of the results listings.

I've gotten a way to make the big "Generalli" image appear when a user types in "München" into the "Wo" input field. But, the banner image will only appear (in other words, the experiment is activated), only when I hit the big orange button twice or more times, or if I refresh the URL. So there is some kind of a timing issue on the manually activated experiment. It has a URL Targeting to include query parameter of ort="münchen", and it appears that the ort= value is not recognized in the time because the search button somehow sends optimizely the previous input information (which would be empty), rather than the newly typed information.

I guess if there were a delay on retrieving that inputted information. It's rather complicated, at least to me (a javascript outsider). Do you have any ideas as to how I could get the experiment activated on the first try?
Certifications, Optimizely
Level 3
CouchPsycho 12-02-16
 

Re: Targeting a Button / Event

Ok,

 

your result listing seems to be loaded via ajax. Which means: Whenever a new list is loaded, you need to do some action. What i usually do is to create an event listener which is waiting for a custom event to be fired, when the list has been displayed completely. Your "twice-clicked"-observation may be related to existing html-structures which are only updated by a new result or a result of the list not beeing loaded when there is not change in your form.

 

You may contact your IT to create a custom event for you, which you may also use in further experiments.

 

Kind regards

 

Michael

 

German: Das wird durchaus nicht einfach. Deine Liste wird per Ajax geladen. Der Punkt, an dem Du Dein Banner einhängen willst, existiert also beim Klicken noch gar nicht. Dein Experiment startet also vermutlich, weiss aber nicht wohin mit dem Banner. Das es beim zweiten oder dritten Klick bei gleichem Suchbegriff funktioniert, spricht für Deine Seite, denn diese lädt dann die Ergebnisse nicht neu, da diese die gleichen wären. Die Liste ist alsi in dem Moment, wo Dein Experiment startet, schon da, deswegen siehst Du das Banner.

 

Am einfachsten wäre es hier wirklich, Deine IT gibt stellt Dir einen custom-Event zur Verfügung. Du schreibst Dir eine Funktion, die das Banner einfügt, und verknüpfst diese dann mit einem document.on("custom_event_name", function{});

 

VG, Michael




"the essence of the creative act is to see the familiar as strange." (anonymous)