Security, Privacy, AI and CSR information for all Piano products now lives in one place. Explore our Compliance Center.
Analytics
English French
English French

Is it possible to send 2 hits to 2 different sites from the same page?

Yes. You can send events to two different level 1 sites from the same page with the Piano Analytics SDK using the onBeforeBuild function.

This method allows you to specify a specific sending configuration for the event. 

In the example below, we are sending two click events to two different sites from the same button.

function(){

pa.sendEvent('click.action', {
  'click' :'click name',
  'click_chapter1' :'chapter 1',
  'click_chapter2' :'chapter 2',
  'click_chapter3' :'chapter 3'
});

pa.sendEvent('click.action', {
  'click' :'click name',
  'click_chapter1' :'chapter 1',
  'click_chapter2' :'chapter 2',
  'click_chapter3' :'chapter 3'
},{
    onBeforeBuild:function (PianoAnalytics, model, next) {
    model.setConfiguration('site','1234');
    model.setConfiguration('collectDomain', 'https://xxxx.pa-cd.com');
    next();
    }});}

Last updated: