Rich-text Reply

Cookie set

mattrobbux 11-16-15

Cookie set

Hi all.

 

I have recently created a survey. There are various multiple choice questions to answer or a user can skip the survey. I want to know If im able to set a cookie so that when a user clicks the skip button they will be shown the survey in their next visit. Is this possible?

 

Thanks a lot. Matt

mattrobbux
JDahlinANF 11-16-15
 

Re: Cookie set

[ Edited ]

@mattrobbux

 

There are a million ways of doing this.  Please describe your curent setup so (is the survey delivered as an experiment?  what is your current audience criteria?  how are you preventing the survey from appearing a second time to the same user who completes it?, etc.) so that we can discuss methods that are appropriate to your current setup and not have you re-engineer the whole thing.

mattrobbux 11-16-15
 

Re: Cookie set

Hi Napoleon, thanks for the quick reply.

Yes the survey is been delivered as an experiment. We are only targeting our desktop audience (5% of total audience).

That is one of my problems too, in that I dont want the user who completes the test to see it again. Not quite sure how to do this.

Cheers

Matt

mattrobbux
mattrobbux 11-16-15
 

Re: Cookie set

I meant who completed the survey.
mattrobbux
JDahlinANF 11-16-15
 

Re: Cookie set

Let's build an audience!

Step 1 - "Audience = All user"

This will cause the experiment to fire for this user now and upon each returning visit.  All we need to do is build a way to turn it off for user who have already completed the experiment.

Step 2 - "Audience = All users that <have not complete it>"

Set a cookie when a user completes the survey.  Set persistence to twice as long as you expect to run the experiment - that way you can extend the experiment a little if need be.  If you can set a cookie, you will create a Custom Audience that excludes users who have that cookie.

If you are unable to set a cookie, let me know and I'll come up with something a bit more elaborate.

JDahlinANF 11-16-15
 

Re: Cookie set

[ Edited ]

Steps to create an audience that includes all user who do not have a cookie named "surveryComplete":

1- On your dashboard's "Overview" tab, click "Audiences"

2- Click the blue [New Audience] button

3- Give your audience a name (e.g., "User without survey completion")

4- Drag [Cookie] from the right column to the "drag and drop condition here" section

5- Change the drop-down from "has" to "does not have"

6- Enter "surveryComplete" for the cookie name

7- Change the drop-down from "equals" to "has any value"

8- Click the blue [Save Audience] button

 

Steps to add the new audience to the experiment that delivers the survey:

1- Edit your experiment

2- Click on the button near the top of the page for "Audience Targeting" - the button is in the top-right corner of the page and appears to be an image of 3 people

3- Click the [+ Add a Saved Audience] button

4- Find the audience you created above and click the [Add] button

5- Click the [Done] button.

6- Save your experiment

 

For steps to add creating this cookie upon survey completion - we'll need to know a bit more about how yoru survey is delivered. 

1- Is it delivered via an iFrame or is it contained within your site? 

2- If "Yes", are you able to use jQuery selectors that look specifically for the "Submit" link on the last page?

3- If "No", are you able to alter the HTML that is the survey?  (This path is for adding a trigger to the 'thank you' page?)

 

Supposing you are able to use jQuery selectors for the Survey's Submit button, and that you have a recent version of jQuery installed on your page, you can run code like this to create the 'surveyComplete' cookie:

window.$('.submitSurvey').on('click',function(){
	document.cookie = "surveyComplete=done; expires=Wed, 16 DEc 2015 00:00:00 UTC";
});

 

 

mattrobbux 11-17-15
 

Re: Cookie set

Hi Napoleon.

 

This is perfect. This is exactly what I am looking for and you have helped a huge amount. 

 

The survey we are using is just html appended to our pages on the website. I am able to use jquery selectors so am going to use what you submited below.

 

I cant thank you enough. Appreciate all the steps regarding the audience too.

 

Will go ahead an do all as you descibed below, it seems really simple as you have explanied it in great detail.

 

Cheers

 

Matt 

 

 

mattrobbux