We’ve migrated our documentation to a new site, which means some URLs have changed.
Analytics

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. The recommended approach depends on the library you use:

  • Piano Analytics SDK: Send events with a per-event override using the onBeforeBuild function.

SDK Piano Analytics

You can send two events to two different sites from the same page with the Piano Analytics SDK and the onBeforeBuild function.

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

In the example below, we are sending two clicks 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://logsXXX.xiti.com');
    next();
    }});}

Last updated: