User_attributes

The user_attributes section in the Touchpoint code snippet lets you pass visitor data back to Touchpoint for targeting. These data points are available when you share an activity on a site and you want to collect data from site visitors who meet specific conditions.

Step 1: Determine the data points that would be valuable for you to pass

What is available on your site? What activities are you planning to distribute and who are the site visitors you want to reach?

Consider your overall goals. You want to pass all the variables you need to target segments of your audience. At the same time, including irrelevant data will interfere in the efficiency of your workflows and data analysis.

Step 2: Modify the user_attributes object in the code snippet

When you are adding the site listing to Touchpoint, in the Code Snippet section, click Enable Visitor Attributes.

Clicking Enable Visitor Attributes adds the object to the code snippet.

Note: We strongly discourage the use of personally identifying information (PII) as targeting attributes. PII includes, but is not limited to, information such as social security numbers, personal home addresses, credit card numbers, financial account numbers, street addresses, and so on.
  • Visitor payload and user attributes can be overlapping, but they are not the same thing.
    • Visitor payload passes in visitor data that can be used in reporting.
    • The user_attributes section is used to define attribute names and their data types to be used for targeting.

    If you want one data point to be available for both purposes, it must be added to both the visitor payload and user attributes.

    The visitor payload can be used without the user attributes.

    However, you cannot use the user attributes without the visitor payload. For targeting, the visitor payload is where you add the attributes you want to pass into Touchpoint. The user attribute area is where you add the data type for that attribute.

    • The data type for user attributes must be defined. Supported data types include:

      • Boolean
      • Date
      • Number
      • String

      If the data type is not correctly defined, the visitor attributes will not surface in Touchpoint.

    • If the user attribute is a boolean, the visitor payload should contain true/false with no quotes.
    • If the user attribute is a date, the visitor payload should contain a date in ISO-8601 format.
    • If the user attribute is a number, the visitor payload should contain a number with no quotes.
    • If the user attribute is a string, the visitor payload should contain a string with quotes.
    • Multiple string values have an "or" relationship. Visitors must have one of the values.
    • If no value exists for a specific attribute for the user, null can be passed in the visitor payload.
    Example
    <script>
        window.topInit = function () {
        Touchpoint.initialize({
          // Please check documentation for other Touchpoint settings that can be configured
          settings:{
            containerStyle: {
              margin: '16px',
              borderRadius: '8px',
              boxShadow:
              '0px 3px 5px 0px rgba(0,0,0,0.2), 0px 1px 18px 0px rgba(0,0,0,0.12), 0px 6px 10px 0px rgba(0,0,0,0.14)'
            }
          },
          visitor: {
            // Pass data points from your site/application to identify the current respondent
            id: VISITOR_ID,
            email: VISITOR_EMAIL,
            eye_color: EYE_COLOR,
            skin_color: SKIN_COLOR,
            country: COUNTRY,
            last_purchase_date: LAST_PURCHASE_DATE,
            segment: SEGMENT,
            credit_card: CREDIT_CARD,
            tier: TIER,
            is_premium: IS_PREMIUM
          },
          user_attributes: {
            // Define attribute data types to be used for targeting.
            // Dates must be in ISO 8601 format
            eye_color: 'string',
            skin_color: 'string',
            country: 'string',
            last_purchase_date: 'date',
            segment: 'string',
            credit_card: 'number',
            tier: 'number',
            is_premium: 'boolean'
          },
          publisher: {
            // Please do not make edits below
            app_id: "kWudr4kaep05yPy",
            pod: "na2",
          },
        });
      };
    </script>
    <script async defer src="https://touchpoint-sdk.visioncritical.com/main.js"></script>