Rich-text Reply

Track Contact Form 7 submit as a Goal

Cocciu 04-13-16

Track Contact Form 7 submit as a Goal

Hi, 

 

I have a form created with Contact Form 7 in Wordpress and I have to track form submissions as goals in Optimizely. 

 

In my Optimizely experiment I set a Custom Goal named MyGoal, and in Contact Form 7 form setup I tried with:

 

on_sent_ok: "window.optimizely.push(['trackEvent', 'MyGoal']);"

 

and also with:

 

on_sent_ok: "window['optimizely'] = window['optimizely'] || []; "
on_sent_ok: "window.optimizely.push(['trackEvent', 'MyGoal']);"

 

but it doesn't work.

 

Any suggestion? 

Thank you,

Level 2

AllisonR 04-14-16
 

Re: Track Contact Form 7 submit as a Goal

Hi there,

 

Can you clarify what behavior you're seeing with your current set up? When you trigger a form submission on the site yourself can you see the conversion firing in the network data like is described here? If so, is there an x parameter with your experiment id included in the request? 

 

You'll want to make sure you've been bucketed into a live experiment in order to see your conversions being tracked. If you're not sure how to check that you've been included in a live experiment, this section of our troubleshooting article outlines this process.

 

Hope this helps! 

 

Best,

 

Allison
Sr. Technical Support Engineer
Optimizely | EMEA

Allison
Sr. Technical Support Engineer
Optimizely | EMEA
Optimizely
Cocciu 04-14-16
 

Re: Track Contact Form 7 submit as a Goal

[ Edited ]

Hi Allison,

 

thank you very much. I tryed with your suggestions, but I still don't see any conversion in the Results page:

 

When I submit my form, I see in the browser console one x parameter with my experiment number, and the n parameter with myGoal. 

Typing  optimizely.activeExperiments  returns []. That's because my form is not in a page tested in the experiment, I think.

Typing optimizely.variationNamesMap returns my experiment number and "original" or "variation #1".

 

So far so good, I think, but in my experiment Results page  I don't see my goal tracked.

 

I've surely done someting wrong, but I don't understand what. Can you help me?

 

Thank you

 

Level 2
AllisonR 04-22-16
 

Re: Track Contact Form 7 submit as a Goal

Hi there,

 

So it sounds like conversions are tracking correctly for this form submission. Have you double checked the name of the custom event in the 'n' parameter exactly matches the name associated with the custom event in your goal set up? 

 

If we can rule out a typo, it sounds like your IP might be filtered from the project. You can verify this on the privacy tab in your project settings. IP Filtering will not prevent you from seeing an experiment; it will simply make sure to filter you and your actions out from the Results page. More details here

 

Does this explain it?

Best,

Allison
Sr. Technical Support Engineer
Optimizely | EMEA

Allison
Sr. Technical Support Engineer
Optimizely | EMEA
Optimizely
Cocciu 05-02-16
 

Re: Track Contact Form 7 submit as a Goal

Hi Allison, sorry for answering you so late.

It's all fine now, my experiment goals are tracking correctly, thank you!

 

So here is the quick instruction I haven't find in the Web:

 

HOW TO DIRECTLY TRACK CF7 FORM SUBMISSION AS GOALS IN OPTIMIZELY EXPERIMENTS

(If you use Contact Form 7 Wordpress plugin and do NOT use a bridge application as Google Analytics)

 

1. In your CF7 FORM > more settings

type:

on_sent_ok: "window['optimizely'] = window['optimizely'] || []; "
on_sent_ok: "window.optimizely.push(['trackEvent', 'MyEventName']);"

2. In your Optimizely experiment set a new goal:

Goal Name: My Form submission goal name
What to Track: Custom events
Custom Event to track: MyEventName

 

That's all. 

Enjoy

 

Level 2