Rich-text Reply

Pushing custom pageview goals

tomfuertes 08-18-15
Accepted Solution

Pushing custom pageview goals

We have a client testing multi step checkout (multiple pageviews) vs single page checkout (multiple sections, all ajax). Is there a way to `optimizely.push(['trackEvent', 'pageviewGoalId'])` like a custom goal id on the ajaxSuccess for the variation that will still track normal pageviews on the control?

- Tom Fuertes | CTO @ CROmetrics / LinkedIn
"Most Impactful Use of Personalization" and "Experience of the Year" Optie award winner.
Experimentation Hero

moravemj 08-18-15

Re: Pushing custom pageview goals

Hey Tom!


There isn't a way to push page view goals manually. I would recommend creating a custom event goal and pushing the goal when the URL matches a condition in the original and when the ajaxSuccess call is complete for the state you expect in the variation. 


Original variation edit code box:


if(window.location.href.indexOf('url to match here') > 0) {
   window.optimizely.push(['trackEvent', 'page_view_goal']);


Variation 1 edit code box:


$(document).ajaxSuccess(function() {
   window.optimizely.push(['trackEvent', 'page_view_goal']);
Junan 08-21-15

Re: Pushing custom pageview goals

Hey Tom,

So I just tested this out and you actually can use the customEvent API call to force a pageview goal. All you have to do is make the trackEvent API call and plugin the URL that you want to track. When Optimizely receives that event, we'll actually compare and count that against the pageview goal (that you pre-defined).

For example:
window.optimizely.push(["trackEvent", ""]);

Hope that helps!
Junan Pang