Targeting based on a custom cookie value | Community
Skip to main content
New Participant
October 16, 2015
Solved

Targeting based on a custom cookie value

  • October 16, 2015
  • 1 reply
  • 2226 views

Hi,

Could anyone please give me an advice on how to create a segment in T&T based on cookie value?

What I've tried to do is to add an Expression Target:

return document.cookie.replace(/(?:(?:^|.*;\s*)network\s*\=\s*([^;]*).*$)|^.*$/, "$1").toLowerCase().indexOf("par_") != -1

This searches for "par_" string in the cookie "network".

When I try to add this Expression Target I get the following error:
Expression for rule Channel: Partner is not valid: "Syntax or runtime error: ReferenceError: "document" is not defined."

I've looked at the Expression Target documentation (http://microsite.omniture.com/t2/help/en_US/tnt/pdf/js_expression_cheat_sheet.pdf) but I could not find any way of how to create the Expression Target based on the cookie.

Can anyone help, please? Perhaps there are also easier way creating segments based on the cookie value?

Thanks,

Lucas

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by chongkan01

See if this helps: 

Option 1: Use the Back-End of your Site to read the cookie and pass some flag to the mboxcreate method during page load. This can be used in the TnT console for targeting.  e.g. 

mboxCreate('orderConfirmPage', parameter=true);

Then, when targeting, if you don't see the mbox parameter in the list, just add it, it should work. 

===============

Option 2: 

- You need to create a plugin-offer that reads the cookie values and stores the values or flags in the profile or user parameters of the mbox with mbox update. You assign this plugin to the desired mbox location. 

- In the targeting options: Visitor Behavior -> YourProfileParameter -> Condition.. 

1 reply

chongkan01Accepted solution
New Participant
October 16, 2015

See if this helps: 

Option 1: Use the Back-End of your Site to read the cookie and pass some flag to the mboxcreate method during page load. This can be used in the TnT console for targeting.  e.g. 

mboxCreate('orderConfirmPage', parameter=true);

Then, when targeting, if you don't see the mbox parameter in the list, just add it, it should work. 

===============

Option 2: 

- You need to create a plugin-offer that reads the cookie values and stores the values or flags in the profile or user parameters of the mbox with mbox update. You assign this plugin to the desired mbox location. 

- In the targeting options: Visitor Behavior -> YourProfileParameter -> Condition..