Create an audience containing visitors who visits a URL containing a certain parameter

miguelm62125791

21-03-2017

Hi!

I want to create an Audience containing visitors who visit a URL which contains a certain parameter, and once visitors visit that URL, I want them to be a part of that audience, and not just when they are on that URL but even when they browse out of it.

How can I do this? I try to do it using a "Site page" rule, but the only rules are "Landing page," "Previous page", or "Current page", and what I need is "If the page has ever been".

Accepted Solutions (1)

Accepted Solutions (1)

Løjmann

21-03-2017

Hi,

in that case, you would benefit from doing a Profile Script, setting a flag in the users target profile, when a page is visits that meet your criteria.

The script below, looks for the query-string parameter 'cid' and if it exists, then the value of cid are set in the profile (named, what every you name the profile script)

try{
    var mboxParam = page.param('cid').toLowerCase() || ""; if (mboxParam != "") {
        return mboxParam;
    }
}
catch(e){
    // Error handling...    
}

This script simply just take the value of cid and store that in the profile, if a new cid-query are set then the value are overwritten.

The following script will stack (add, comma separated list) and remove duplicated values:

// Better stacking via user-profile (no duplicates)
try{
    var mboxParam = page.param('cid').toLowerCase() || ""; if (mboxParam != "") {
        if(user.get('custcmp')) {
            if (user.get('custcmp').indexOf(mboxParam) != -1) {
                mboxParam = user.get('custcmp');
            }
            else {
                mboxParam = user.get('custcmp') + ',' + mboxParam;
            }        
        }
        return mboxParam;
    }
}
catch(e){
    // Error handling...    
}

Hope this helps?

/Løjmann

Thomas Løjmann Jørgensen
Lead Solution Architect - Adobe Marketing Cloud
www.ecapacity.com

Answers (7)

Answers (7)

Løjmann

22-03-2017

Hi,

I would say that it should work. Are the profile script activated? Another thing could be casing, if the query are Referidos and the script are looking for referidos, then it won't work...

/Løjmann

miguelm62125791

22-03-2017

Hi Thomas,

I have created the Profile Script using the following code:

try{ var mboxParam = page.param('referidos').toLowerCase() || ""; if (mboxParam != "") { return mboxParam; } } catch(e){ // Error handling... }

after that, I have created the following Audience:

user.Referidos equals s

 

however seems that the test is not being activated, Please could you tell me what I am doing wrong?

Thank  you

Løjmann

21-03-2017

Hi,

No, you would need to add the full code. I would wrap it in a try-catch, to avoid errors (even so the code are running server-side)

try{
    var mboxParam = page.param('referidos').toLowerCase() || "";
      if (mboxParam != "") {
       return mboxParam;        
      }
   }
}
catch(e){
   // Error handling...    
}

Then the profile parameter are only set, if the querystring referidos exists, and it get's the value of the query string (value = 's', in your example URL)

/Løjmann

miguelm62125791

21-03-2017

Thank you for your answer Thomas,

 

so if I understand well, I only need to add the following code inside the profile script:

                            page.param(‘referidos’) == s

Thank you. 

PS: We are using the following parameter www.oururl.com?referidos=s

miguelm62125791

21-03-2017

Hi Thomas,

Thank you for your answer. What I need is even simpler, in the activity I want to include, all the visitors who at any moment, visit a page which contains this parameter: ?referidos=s  

How can I do this? From your answer I guess that I need to create a profile script, but I don't know how to do it

 

Thank you

 

 var mboxParam = page.param('referidos').toLowerCase() || ""; if (mboxParam != "") {
        return mboxParam;
    }