Rich-text Reply

Tracking goals without pageviews

morny 12-09-14

Tracking goals without pageviews

[ Edited ]

I have a bit of issue. Im limited because i dont have access to the server, thats the whole idea of using optimizely so we could avoid having to involve developers having to code.


With that in mind here is my issue.


I have 4 variations and 3 products. I have made tweaks to each variation in an attempt to see does it affect the product choices as there different price levels.


Ideally i would use a goal for pageviews like:



What happens is there is a dropdown with the purchase options, you select the radio button to choose the product and then hit the buy now button.


Now i managed to write some javascript to paste ?id=1 onto the end of the form action but when it arrives on cart.php it clears away the URL params, most likely for security or as part of the normal processing of the framework. So i cant really use params to create a pageview goal and essentially no matter what product i choose it just forwards as cart.php and nothing else to identify the products


Is there another way to do this to track a goal using the custom option. What im thinking is ill create an onchange event that fires when someone selects a radio button, then send that to optimizely to setup a custom goal. Is this possible and if so can you give me an example or maybe there is a more efficient way of doing this.

Level 2

Aisha 12-09-14

Re: Tracking goals without pageviews

Hi morny,

If I understand you correctly, you're trying to track views on several pages such as cart.php?id=1 and cart.php?id=2, but when you append these parameters to the page, they disappear as soon as the page is loaded.

If that's the case--where your site will not maintain those parameters--then you would need to use a custom event goal or even a click goal on the "buy now" button to track these events. The easiest thing to do probably be to use a simple click goal since you can set that up on the "buy now" button to see how many times it was selected.

Would that work for you in this instance or are you looking for an event besides just the click?


Customer Success and Technical Support @ Optimizely!
morny 12-10-14

Re: Tracking goals without pageviews

Click wouldnt work in this example simply because i have 3 products as radio buttons and a buy now button, if someone clicks the buy now button then i still need to know which product was selected so tracking clicks would only tell me A product was added to cart not WHICH product. I thought about putting a click goal on the radio button but one product is selected by default so in some cases the radio button wouldn't be clicked.

So i think the best solution is a custom event goal. Can you give me a simple example of a custom event goal.

What i want is to create a custom goal by passing a variable to optimizely which will be the product ID, then on the cart.php page it will look for the id and then set a goal based on that.

For example if its ID 1 it will trigger the "Gold Goal", if its ID 2 it will trigger the "Silver Goal" and it its ID 3 it will trigger the "Bronze Goal"

So essentially i kind of want to set a session variable which identifies which product was selected and then create the goal based on that on other future pages. Pretty much the same way you assign someone to a variation, once they arrive on that variation it sets a session variable and on all future pages it tags that goal under that variation.

If anything is unclear please let me know and ill try and explain further. Appreciate your help on this
Level 2
morny 12-10-14

Re: Tracking goals without pageviews

bump in case it was missed.

Level 2
td_evans 12-11-14

Re: Tracking goals without pageviews

Hi Morny,


I've written a short JSFiddle which I think could cover what you're trying to do:


Essentially what I'm doing is collecting the selected radio button when the "Pay Button" is clicked. You can then push that as a custom event into Optimizely, and have that as a goal. 


Hopefully this is what you were after?



Thomas Evans
Technical Product Manager - Conversion @ Secret Escapes

Level 2