Skip to main content

         This documentation site is for previous versions. Visit our new documentation site for current releases.      

Enabling your website to capture paid clicks

Updated on August 6, 2021

To capture information about the way in which individuals interact with your ads, do the following steps:

  1. Use your first-party identity management solution to make the customer ID available for the PaidCaptureResponse service when a known individual visits your website.
    Note: If you do not have an existing identity matching solution, Pega Customer Decision Hub provides an identity management functionality that you can implement. For more information, see Identity management for the Container REST service.
  2. To determine the interaction ID that drove the ad click, implement the webwb/RealTimeContainerScript.js JavaScript file on your website to call the capturePaidClickResponseExt function, which communicates the customer ID and action ID to Paid Media Manager. For more information, see Configuring a container invocation script.
Note: Specific ad platforms have different requirements for configuring the click URL. Refer to the destination-specific sections of this article for more information.

For an example of a service call, see Enabling your website to capture paid clicks.

Available parameters

  • CustomerID - Required. Used to identify individuals based on information captured during their interactions with the destination.
  • Adset_id - Required for Facebook Ads and Google Ads. Used to identify which next-best-action paid audience was used to target the individual with the ad, resulting in the click. The parameter corresponds to the ad set on Facebook Ads, and ad group on Google Ads.
  • ExternalAudienceId - Required for other ad platforms, for example, LinkedIn Ads. Used to identify which next-best-action paid audience was used to target the individual with the ad, resulting in the click. For more information, see Retrieving the external audience ID.
  • DestinationType - Optional. Used to identify the destination type. You can specify it if you are sure about the source of the click (that is, if you can identify the source platform either as Facebook Ads or Google Ads). If the ClickThroughURL parameter contains the adset_id (Facebook) or adgroup_id (Google), Paid Media Manager can also automatically recognize the destination type as Facebook or Google.
  • ReferrerUrl - Optional. The HTTP referrer of the requested website. You can obtain by using the document.referrer web API.
The service call must include the callback function. The function is required to process the response coming from the Paid Web Service. It inserts data into the following Interaction History tables:
  • The referrerurl, utm_medium,externalaudienceid columns of the pr_data_ih_fact table
  • The pydirection, pychannel, channelgroup, channelsubgroup columns of the pr_data_ih_dim_channel table
  • The pyoutcome and pybehaviour columns of the pr_data_ih_dim_outcome table. The value of pyoutcome is always set to PaidClick and the value of pybehaviour is set to Positive.
After the paid click outcomes are recorded in Interaction History and the Adaptive Analytics data set, you can use the information in your reporting, modeling, and Next-Best-Action.

Retrieving the external audience ID

For platforms other than Facebook Ads and Google Ads, the external audience ID is required on the destination click URL for to determine which audience resulted in the click. It acts as a unique identifier, enabling you to determine the action for which the audience was created.

For Facebook Ads and Google Ads, you can instead use the ad set/group ID, which you can configure within Facebook or Google Ads to be dynamically added to the destination click URL. Paid Media Manager can determine the NBA paid audience that drove the click based on this parameter, so for these ad platforms you do not need to manually modify the destination click URL for each ad.

To retrieve the external audience ID, do the following steps:

  1. Use Paid Media Manager to create paid audiences that are based on an existing customer segment, outbound runs, or real-time container updates.
  2. After the run is finished, in the Pega Customer Decision Hub portal, click AudiencesPaid Media Audiences.
  3. Find the audience that was created in the ad platform and note the ID in the Audience key field, as in the following figure:
    External audience ID on the Paid Media Audiences page
    External audience ID on the Paid Media Audiences page
  4. In the ad platform, for example, LinkedIn Ads, edit or create an ad and add the external audience ID to the destination URL, for example,
Result: If an individual clicks on an ad resulting from a Next-Best-Action decision, the response is available in Interaction History and the adaptive analytics data set.

Sample service call for the CapturePaidResponse REST service

CapturePaidResponse is a REST service that captures customer responses to actions in the individuals' Interaction History. The responses are posted to adaptive analytics in order to allow adaptive models to learn. The service supports the POST HTTP method.

The following is an example of JSON data for a POST request for a LinkedIn Ads paid click:{"CustomerID" : "1234","ExternalAudienceId" : "a12sd","ReferrerUrl" : "","Utm_medium" : "LinkedIn","AdSetId" : "","DestinationType" : "LinkedIn","Outcome" : "PaidClick"}
  • Previous topic Enabling AI-driven advertising with paid click capture on Facebook Ads, Google Ads, and other platforms
  • Next topic Capturing paid interactions

Have a question? Get answers now.

Visit the Support Center to ask questions, engage in discussions, share ideas, and help others.

Did you find this content helpful?

Want to help us improve this content?

We'd prefer it if you saw us at our best. is not optimized for Internet Explorer. For the optimal experience, please use:

Close Deprecation Notice
Contact us