Adobe Target Profile Scripts Explained

UPDATED: December 17, 2024 - Scroll down to see updated examples of profile scripts you can copy and use for personalization.

Introduction

Adobe Target Profile Scripts are a powerful tool for improving the user experience on your website. These scripts allow you to profile how different customer segments interact with your website. By segmenting customers by location, device type, or purchase history, you can improve the customer experience for each group or segment of your users. Adobe Target Profile Scripts are easy to use, and implementation is quick. They are a valuable tool for any website that wants to improve the customer experience through personalization.

What are Adobe Target Profile Scripts, and what do they do?

Profile scripts help you understand how different customer segments interact with your website. You can use this information to improve the customer experience. Adobe Target Profile Scripts segment customers by their location, device type, or purchase history (and much more).

Some benefits of using profile scripts include:

  • improved user experience through Adobe Target personalization.
  • segmentation of customers.
  • understanding customer interactions.
  • ability to make changes based on the customer profile.

Profile scripts can add information to your user's profiles before Adobe Target evaluates the user for specific activities. This logic can help you show the right content to the right person at the right time. If you want to improve your website and customer experience, Adobe Target Profile Scripts are a great option.

How to get started with Adobe Target Profile Scripts

First, create a profile script by going to the "audience" section of Adobe Target and clicking on the "Create Script" button:

Profile scripts library in Adobe Target.
Adobe Target Audience Menu

Next, provide a name for your script and a description:

Screen: Create Profile Script

Adding the Script

Next, you will need to add the script to update the user profile. This is where a target developer comes in handy, and this is someone who is usually familiar with JavaScript. Adobe Target Profile scripts utilize the JavaScript Rhino engine, server-side JavaScript. There are also a few examples that a non-technical user can take advantage of. One of the most common is the two groups, which allows profile scripts to test mutually exclusive activities. By excluding certain traffic, you can ensure that testing does not impact the user experience. This allows you to focus on a specific audience and provides more accurate results.

Profile scripts can also be used to test different versions of an activity. This allows you to compare how each version performs and make the best decision for your business. In addition, profile scripts can be used to test different combinations of activities. This allows you to see how different combinations impact the user experience and make the best decision for your business.

The following is the 'two groups' code example:

if (!user.get('twogroups')) {
    var ran_number = Math.floor(Math.random() * 99);
    if (ran_number <= 49) {
        return 'GroupA';
    } else {
        return 'GroupB';
    }
}

Source: experienceleauge.adobe.com

With this code, you can now fill in Create Profile Script section:

Screen: Create Profile Script (information added)

Using the Profile Script

Once all the information is filled out and the script is in place, you can save and activate the profile script. Now your profile script is ready to be used. Navigate to the audience library tab and click on the big blue 'Create Audience' button and follow these steps:

  • Select 'Visitor Profile' and drag it into the builder screen.
  • In the 'Select attribute' drop-down, find your newly created profile script and select it. In my example, my profile script is named 'user.two_groups_example', which shows up when searched.
  • Choose the evaluator 'Contains (case insensitive).'
  • Choose comparison type 'static value' and add either 'GroupA' or 'GroupB' depending on which group you want to use. I have used 'GroupA' in my example:
Screen: Create Audience

Now you have an audience that you can use in Adobe Target activities. We can use this audience to show specific activities to people who are part of 'GroupA' or exclude them entirely from other experiences.

Review The Benefits

There are numerous benefits associated with the use of Adobe Target Profile Scripts, making them an invaluable tool for any business seeking to optimize their online customer experience. With these scripts, marketers and developers can segment their customers by various parameters, including location, device type, or purchase history. Such segmentation allows for a more tailored interaction with each customer, thus enhancing the overall customer journey and contributing to improved satisfaction rates.

Segmentation is critical to delivering the right content to the right audience at the right time. By allowing segmentation based on a variety of factors such as location, Adobe Target Profile Scripts enable businesses to create location-specific campaigns or promotions. If a customer is segmented by device type, businesses can ensure they deliver an optimized experience based on the user's device capabilities, whether they're on a mobile, tablet, or desktop.

Moreover, segmentation based on purchase history can provide businesses with insights into customer behavior and preferences, making it possible to offer personalized recommendations and incentives that are likely to resonate with each individual customer. This level of personalization can result in higher engagement rates, better conversion rates, and ultimately increased revenue.

Easy to Use

Ease of use is another significant benefit of Adobe Target Profile Scripts. Unlike some complex programming scripts, Adobe Target Profile Scripts are straightforward and user-friendly. They require only a few lines of code to be added with Adobe Target, making them accessible to both beginners and seasoned developers alike. This ease of use ensures that businesses can quickly implement and start benefitting from these scripts, without needing to invest considerable time and resources into learning and setup.

Conclusion

In conclusion, if you're seeking a versatile and user-friendly way to segment your customers and enhance the overall customer experience on your site, Adobe Target Profile Scripts presents an excellent option. Not only do they offer diverse segmentation capabilities, but they also allow for a level of personalization that can significantly boost customer engagement and satisfaction. Moreover, their ease of use ensures a smooth implementation process, allowing your business to reap the benefits of improved customer experience management quickly.

UPDATE: Check out our new post for more examples.

NEW UPDATE: More examples of profile scripts you can use for Personalization:

1. Return 'true' on third-page view of a specific group of URLs

Below is a profile script that increments a counter each time a visitor views one of the specific pages (you can add more as needed), and returns true on the 3rd page view within that set. You can then create an audience in Adobe Target using this profile script’s return value.

Instructions:

  • Replace the targetUrls array with the URLs or patterns you want to track.
  • Run this profile script on a global mbox (e.g., target-global-mbox) so it executes on every page load.
  • On the visitor’s 3rd page view from the specified URLs, the script will return true.
  • On other pages or before the 3rd qualifying view, it will return false.
// Define the specific pages you want to track.
// Replace the URLs below with the actual page URLs or partial matches.
var targetUrls = [
    "https://albertacg.com/openai-o1-adobe-analytics-sdr/",
    "https://albertacg.com/how-to-prepare-for-black-friday-2024/",
    "https://albertacg.com/creating-a-dynamic-data-feed-for-adobe-target-recommendations/",
    "https://albertacg.com/how-to-drive-personalized-content-with-adobe-target-recommendations/",
    "https://albertacg.com/mastering-ai-integration-how-to-use-chatgpt-and-adobe-target-together-for-optimal-results/",
    "https://albertacg.com/mastering-data-insights-how-to-use-chatgpt-and-adobe-analytics-together-for-unmatched-results/",
    "https://albertacg.com/seamless-migration-transitioning-from-adobe-appmeasurement-to-web-sdk-for-enhanced-analytics/",
    "https://albertacg.com/unlocking-the-future-of-digital-marketing-with-adobe-experience-platform-trends-and-insights/",
    "https://albertacg.com/adobe-analytics-vs-customer-journey-analytics-unveiling-the-best-tool-for-insightful-data/",
    "https://albertacg.com/10-shocking-adobe-target-features-you-arent-using-but-should/"
  ];
  
  // Get the current page URL
  var currentPage = page.url || "";
  
  // Retrieve the stored count of how many times the user has visited one of these URLs.
  var count = user.getLocal('pageViewCountForGroup') || 0;
  
  // Check if the current page is within our target set of URLs
  for (var i = 0; i < targetUrls.length; i++) {
      if (currentPage.indexOf(targetUrls[i]) > -1) {
          // Increment the count since the user is viewing one of our target pages
          count = count + 1;
          
          // Update the stored count
          user.setLocal('pageViewCountForGroup', count);
          
          // Break out of the loop since we found a match
          break;
      }
  }
  
  // Return true on the visitor's 3rd qualifying page view, otherwise false
  return (count === 3);

2. New vs. Returning Visitor

Description:


Segment visitors into new and returning users to tailor experiences accordingly.

if (user.isFirstSession) {
    return "New Visitor";
} else {
    return "Returning Visitor";
}

3. Return Tracking Code

Description:

Captures the UTMs from a user's URL if they exist.

if (!user.getLocal('utm')) {
    if (page.param('utm')) {
        user.setLocal('utm', page.param('utm'));
    }
}
return user.getLocal('utm');

4. Time of Day Segmentation

Description:

This script returns the time of day based on the user's time zone.

var hour = new Date().getHours();
if (hour >= 5 && hour < 12) {
    return 'Morning';
} else if (hour >= 12 && hour < 17) {
    return 'Afternoon';
} else if (hour >= 17 && hour < 21) {
    return 'Evening';
} else {
    return 'Night';
}

5. Social Media Referrer

Description:

Returns 'true' if the user's referring domain is a social media site.

var socialDomains = ['facebook.com', 'twitter.com', 'instagram.com', 'x.com', 'bluesky.com', 'truethsocial.com', 'tiktok.com', 'linkedin.com', 'pinterest.com'];
for (var i = 0; i < socialDomains.length; i++) {
    if (referrer.domain.indexOf(socialDomains[i]) != -1) {
        return true;
    }
}
return false;

Continue to check back, as we will add more profile scripts soon!

Cover Photo by Ben Sweet on Unsplash

Contact Us

Other posts you might be interested in:

'}}
Master Adobe Real-Time Customer Data Platform: The Ultimate Marketer’s Guide for 2024
Unlock the full potential of your marketing strategy with "Master Adobe Customer Data Platform: The Ultimate Marketer
'}}
Creating a Dynamic Data Feed for Adobe Target Recommendations
Enhance your website’s personalization by integrating CMS Content data with Adobe Target.
'}}
Master Mobile Insights: The Ultimate Guide to Adobe Analytics App Tracking
Unlock unparalleled mobile insights with Master Mobile Insights: The Ultimate Guide to Adobe Analytics App Tracking.