Redirect
Use the RTP Redirect API to send segmented audiences to a target URL.
- You must be a Web Personalization customer and have the RTP tag deployed on your site before using the User Context API.
- RTP does not support Account Based Marketing named account lists. ABM lists and code only pertain to the uploaded account lists (CSV files) managed within RTP.
Usage
rtp('send' , 'redirect' , 'field_name' , [ 'values_array' , '...' , '...' ] , 'www.redirect_url.com' , true/false )
Parameter
Optional/Required
Type
Description
‘send’
Required
String
Method action.
‘redirect’
Required
String
Method name.
field_name
Required
String
Field name to match against. Example: ‘abm.name’ (see below).
values_array
Required
Array
List of values to match the field against (not case sensitive).
redirect_url
Required
String
Target url to redirect visitors that matched the condition.
redirect_matched_visitors
Optional
Boolean
If true, condition matched visitors will be redirected. If false, condition unmatched visitors will be redirected. Default: true.
Redirect conditions can use organization, industry, ABM lists, location, ISP, or matched segments.
Condition
Data Hierarchy
Example
Matched Segments (Works only after first click)
matchedSegments.name
rtp( ‘send’, ‘redirect’ , ‘matchedSegments.name’ , [‘Fortune 1,000’ , ‘Enterprise’] , ‘https://www.example.com’);
Matched Segments (Works only after first click)
matchedSegments.id
rtp( ‘send’, ‘redirect’ , ‘matchedSegments.id’ , [ 106 , 107 , 190 ] , ‘https://www.example.com’);
ABM Lists
abm.name
rtp( ‘send’, ‘redirect’ , ‘abm.name’ , [ ‘top_key_accounts’, ‘active_customers’ ] , ‘https://www.example.com’);
Location
location.country
rtp( ‘send’, ‘redirect’ , ‘location.country’ , [‘United States’], ‘https://www.example.com’);
Location
location.state
rtp( ‘send’, ‘redirect’ , ‘location.state’, [‘ca’], ‘https://www.example.com’);
Location
location.city
rtp( ‘send’, ‘redirect’ , ‘location.city’, [‘San Mateo’], ‘https://www.example.com’);
Industries
industries
rtp( ‘send’, ‘redirect’ , ‘industries’ , [‘Education’], ‘https://www.example.com’);
Notes
- To reduce latency for a redirect based on Firmographics, such as company, industry, or location, insert the redirect code before rtp(‘send’, ‘view’) and rtp(‘get’,‘campaign’).
- Place the redirect code immediately after the rtp tag in the page header.
- Optimize website loading to improve the speed of the browser-side JavaScript redirect.
- Avoid self-redirects. rtp includes a safeguard that blocks cyclic redirect calls.
<!DOCTYPE html>
<html lang="en-US">
<head>
<!-- RTP tag -->
<script type='text/javascript'>
// This tag needs to be replaced with your account tag
(function(c,h,a,f,i){c[a]=c[a]||function(){(c[a].q=c[a].q||[]).push(arguments)};
c[a].a=i;var g=h.createElement("script");g.async=true;g.type="text/javascript";
g.src=f+'?rh='+c.location.hostname+'&aid='+i;var b=h.getElementsByTagName("script")[0];b.parentNode.insertBefore(g,b);
})(window,document,"rtp","//xyz.marketo.com/rtp-api/v1/rtp.js","xyz");
// START REDIRECT EXAMPLE
// - Using a helper redirect function
// - Redirect based on named account
rtp('send','redirect','org', ['microsoft'],'http://www.marketo.com');
// Redirect based on named account list (ABM)
rtp('send','redirect','abm.name', {
// Redirect visitors that match 'first_abm' list to www.marketo.com
'http://www.marketo.com' : ['first_abm'],
// Redirect visitors that match 'second_abm' list to blog.marketo.com
'http://blog.marketo.com' : ['second_abm']
});
// END REDIRECT EXAMPLE
rtp('send','view');
rtp('get','campaign');
</script>
<!-- End of RTP tag -->
How to Redirect Tracked Visitors
- Append the parameter to the target URL, for example, <www.marketo.com?rtp=redirect>.
- Create a segment with the name “Redirected by RTP”.
- Use the ‘Specific Pages’ parameter to target visitors who view a page that contains the parameter.
How to Define More Than One Condition with Different Target URLs
The redirect call supports multiple calls. Use multiple calls to combine fields and create conditions with different URLs and values.
Usage
rtp('send', 'redirect', field_name, url_values_map);
Parameter
Optional/Required
Type
Description
‘send’
Required
String
Method action.
‘redirect’
Required
String
Method name.
field_name
Required
String
Field name to match against. Example: ‘abm.name’ (see above).
url_values_map
Required
Object
Map between redirect url and list of values. Example:{‘https://www.example.com’ : [‘first_abm’, ‘second_abm’]}
Example
rtp('send','redirect','abm.name', {
// Redirect visitors that match 'first_abm' list to www.marketo.com
'http://www.marketo.com' : ['first_abm'],
// Redirect visitors that match 'second_abm' list to blog.marketo.com
'http://blog.marketo.com' : ['second_abm']
});
rtp('send','redirect','org', {
// Redirect visitors from 'Microsoft' to www.marketo.com/enterprise
'http://www.marketo.com/enterprise' : ['microsoft']
});
recommendation-more-help
marketo-developer-help