Expand my Community achievements bar.

Applications for the 2024 Adobe Target Community Mentorship Program are open! Click to the right to learn more about participating as either an Aspirant, to professionally level up with a new Certification, or as a Mentor, to share your Adobe Target expertise and inspire through your leadership! Submit your application today.
SOLVED

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

Avatar

Level 2

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".

1 Accepted Solution

Avatar

Correct answer by
Level 5

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

View solution in original post

8 Replies

Avatar

Correct answer by
Level 5

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

Avatar

Level 2

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;
    }

Avatar

Level 2

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

Avatar

Level 5

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

Avatar

Level 2

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

Avatar

Level 5

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

Avatar

Level 2

Thank you Thomas,

Yes, the code is working, I had forgotten activate the profile script. :-)