How to validate custom variables set by RTP API

ashirwad
Level 1

How to validate custom variables set by RTP API

Hello,

We are trying to set custom variables through RTP API to detect the user type and show campaign on the website accordingly. Following is the code snippet we are using:

<script type='text/javascript'>
(function(c,h,a,f,i,e){c[a]=c[a]||function()
{(c[a].q=c[a].q||[]).push(arguments)};
c[a].a=i;c[a].e=e;var g=h.createElement("script");g.async=true;g.type="text/javascript";
g.src=f+'?aid='+i;var b=h.getElementsByTagName("script")[0];b.parentNode.insertBefore(g,b);
})(window,document,"rtp","//lonrtp1-cdn.marketo.com/rtp-api/v1/rtp.js","****sites");

// Set custom variable
rtp('set', 'customVar1', 'rtp_user');

rtp('send','view');
rtp('get', 'campaign', true);

// Set custom variable
rtp('set', 'customVar2', 'rtp_user2');

</script>

Also User Context API filter has been set on the segment

ashirwad_0-1656435672750.png

However, as soon as we set these filters, campaign is not visible on the page and after removing these filters it appears on the page.

 

Is there a way to verify if these custom variables are set properly?

 

Thanks in advance for your time.