Create an audience containing visitors who visits a URL containing a certain parameter | Community
Skip to main content
miguelm62125791
New Participant
March 21, 2017
Solved

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

  • March 21, 2017
  • 8 replies
  • 4059 views

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

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 Løjmann

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

8 replies

miguelm62125791
New Participant
March 28, 2017

Thank you Thomas,

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

Løjmann
New Participant
March 22, 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

New Participant
June 13, 2024

Hi Thomas,

How to build the below audience in Adobe target:

1. To check if the user is coming from mobile
2. To check is he is accessing XYZ URL
3. And the user limit crosses 500

miguelm62125791
New Participant
March 22, 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
New Participant
March 21, 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
New Participant
March 21, 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

Løjmann
New Participant
March 21, 2017

Hi,

You would create them under Segments -> Profiles in Target, see more here :https://marketing.adobe.com/resources/help/en_US/tnt/help/c_Using_Script_Profile_Parameters.html

/Løjmann

miguelm62125791
New Participant
March 21, 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;
    }

Løjmann
LøjmannAccepted solution
New Participant
March 21, 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