Hello,
I created a simple Profile Script that pulls the value of a query string and stores it.
This is only part of the script to demonstrate:
var myParam = page.param('querystring').toLowerCase() || "";
if (myParam != "") {
return myParam;
Then I created an audience that evaluates the query string values (myParam) and visitors that match a specific one (qs1) become part of the audience.
Visitor Profile: user.querystring equals (case sensitive) qs1
I created an XT activity and used the audience. I browsed a page on our site and made sure I had querystring=qs1, this is to qualify me to the audience and so I can see the personalization.
I tested this setup multiple times and used Incognito. Sometimes, I browsed a page w/ the query string and then I go to the page where the personalization is and I see the personalized content immediately - no lag. Sometimes, I saw the personalization but waited about an hour before it showed up. Another time, the lag is more than an hour.
If I browse to the page with the test query string that adds me to the audience, then to the personalized page, is it normal to have a lag? Is it also normal for that lag to be inconsistent (sometimes no lag, sometimes an hour, sometimes more)?
Is there a different way using Profile Script + a Target audience to have the experience show up immediately all the time? In other words, eliminate the lag.
Thanks!
Solved! Go to Solution.
Topics help categorize Community content and increase your ability to discover relevant content.
hi @michaela7702973 - since you are using same URL parameter but two different values for your audiences, I'll suggest configuring two profile-scripts instead of one, for each param-value combination. That will give you much better control on personalised experience delivery.
Let me know if you have any further thoughts
Regards
Rajneesh
Views
Replies
Total Likes
hi @michaela7702973 - the lag you have mentioned is not expected. Profile attributes created through profile scripts are available for audience-qualification in real-time.
The profile-script code looks good to me and that it works for you sometimes means it does not have any issues.
While "lag" will require deeper investigation, lets find out whether there are any issues in audience-qualification. Could you please:
1. Activate the profile-attribute as response-tokens.
2. Check the value of your profile-attribute on the page where personalisation needs to be delivered.
3. Confirm that the profile-attribute value is as expected.
If results from this test are expected then you may need to look at a few scenarios:
1. Activity-check: Using response-tokens, check that you are getting qualified expected experience every time.
2. There are no clashing activities
Lets connect again once you have run these tests. Looking forward to hearing back,
Regards
Rajneesh
Hello Rajneesh,
Thank you for looking into this. I have two activities set up with each activity using a different audience.
The first activity evaluates the entire cid query string; e.g. cid=somevalue. If a visitor goes to any page and has the exact cid query string value in it's entirety, that visitor will qualify for the activity. Then on the page where the activity Delivery is set up, some personalization happens.
I added the response token as advised then purposely went to a page with the cid query string to qualify myself to the activity. It worked. I can see the response tokens and the personalizations were applied.
For the second activity, the audience used evaluates the cid query string and looks for something within the string. Therefore, it's set up like so: Visitor Profile: user.cid_param Contains (case insensitive) somethingincid. e.g. if the cid query string is cid=thisvalue:somethingincid:anothervalue, this should qualify because somethingincid is in the cid string.
Once again, I purposely went to a page with the cid query string to qualify myself to the activity. It didn't work, the personalization was not shown. In Console network tab, I filtered by "delivery" and went to the preview tab. The response tokens aren't there, possibly because I didn't qualify for the activity?
Note that I only have one profile script set up to pull the cid string. The profile script is as follows:
Profile script name: cid_param
try{
var mboxParam = page.param('cid').toLowerCase() || "";
if (mboxParam != "") {
return mboxParam;
}
}
catch(e){
// Error handling...
}
This is the dev console for the second activity that I did not qualify for. Now having said all this, it could be that the "lag" is happening again and I could refresh the page and all of a sudden qualify if I try later.
Views
Replies
Total Likes
Rajneesh, I found out an error with the way I tested the second activity. When I did my page view with the cid string, I used an incorrect query string. I corrected it and the personalization immediately worked.
I would like to re-test these test cases so I will keep this thread open for now. Please stay tuned.
Views
Replies
Total Likes
@Rajneesh_Gautam_ I found out what might be causing the issue. Here's how I'm testing the two audiences and activities.
Audience 1:
Visitor Profile: user.cid_param equals (case sensitive) aquerystringhere
Audience 2:
Visitor Profile: user.cid_param Contains (case insensitive) anotherquerystringhere
As you can see, the two audiences are somewhat similar. The first one evaluates the entire string and if it matches a specific string I'm using, the visitor qualifies for this audience. The second audience is like a partial match; if part of the query string used by the visitor is found, the visitor qualifies for it.
To test, I followed these steps.
1) I went to a webpage and appended the cid query string on purpose to qualify for Audience 1; e.g. https://www.mysite.com/page1/?cid=aquerystringhere.
2) I opened another tab. I went to the page where Activity 1 was delivered to check if the personalization was applied. It was. So far, so good.
3) I opened another browser tab. I repeated similar steps - I went to a page and appended the specific cid string to qualify for the second activity; https://www.mysite.com/page2/?cid=anotherquerystringhere.
4) Then I went to the page where the Activity 2 was delivered. The personalization was applied. At this point, both activities appear to be working.
5) Here is where it fails. I went back to the browser tab where the Activity 1 was being applied. I refreshed the page and the personalization was gone, the page reverted back to the default experience.
6) I was wondering if the first activity stopped working because I went to another page with the second query string (step 3). So, I once again went to a page and appended the cid with the string to qualify for Activity 1 - note that this is the second time I've done this. I refreshed the page where Activity 1 was delivered. The personalization was once again applied.
Therefore, my observation is that the activity works fine at first but they stop working when another page view happens and the cid query string value is changed. The first activity worked immediately after I went to a page with the cid string that made me qualify for Audience 1. When I opened a new browser tab and went to a different page with the cid string that made me qualify for Audience 2, the first activity stopped working. How can I set it up so that a visitor can qualify for both activities/audiences rather than only qualifying for the audience that matches the MOST RECENT cid string used?
Thank you.
Michael
Views
Replies
Total Likes
hi @michaela7702973 - since you are using same URL parameter but two different values for your audiences, I'll suggest configuring two profile-scripts instead of one, for each param-value combination. That will give you much better control on personalised experience delivery.
Let me know if you have any further thoughts
Regards
Rajneesh
Views
Replies
Total Likes
@Rajneesh_Gautam_ I will make a second profile script and test it out. I'll let you know how it turns out. Once again, thanks.
Views
Replies
Total Likes
@Rajneesh_Gautam_ I made more changes last week but couldn't make it work. The visitor was being added to the first audience after I visit with the corresponding cid query string for that audience. But when I use the second query string to add the visitor to the second audience, the visitor is removed from the first audience.
I changed my approach and got it working. I will go over the solution here in case anyone else experiences this issue.
1) I made two new profile scripts.
Profile script 1
Profile script name: cid_equals_test1
try{
var mboxParam = page.param('cid').toLowerCase() || "";
if (mboxParam != "") {
if (mboxParam == 'querystring1'){
return "true";
}
}
}
catch(e){
// Error handling...
}
As you can see, this script is evaluating if the query string has a specific value. If it is a match, it returns true.
Profile script 2
Profile script name: cid_equals_test2
try{
var mboxParam = page.param('cid').toLowerCase() || "";
if (mboxParam != "") {
if (mboxParam.indexOf("querystring2") > -1) {
return 'true';}
}
}
catch(e){
// Error handling...
}
This second profile script is similar to the first one but instead of matching the entire query string, it looks for a partial match. If there is a match, it returns true.
2) I made two Audiences.
Audience 1: Visitor Profile: user.cid_equals_test1 equals (case sensitive) true
Audience 2: Visitor Profile: user.cid_equals_test2 equals (case sensitive) true
This setup works. The main difference from my previous approach is that I evaluated the query string in the profile script itself instead of in the audiences. In the profile script, if there's a match with the specific query string or part of a query string that qualifies a visitor to the audience, it returns "true". The audiences simply qualify visitors who have "true" on their profile.
This has been tested since last week and the visitors who belong to the audiences do show the appropriate personalization. I also made sure that the personalizations are sticky, meaning they are still shown in successive visits.
Thank you for your assistance.
Views
Replies
Total Likes
great @michaela7702973 - your new setup is perfect and fits to the solution I provided. Glad to know it worked for you, well done!
Regards
Rajneesh
Views
Replies
Total Likes
Views
Like
Replies
Views
Likes
Replies