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
onBeforeBuildfunction.SmartTag: Initialize two distinct tags (one configuration per site) so each tag generates its own hit.
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();
}});}
SmartTag (deprecated)
It is absolutely possible to send two separated hits to two different level 1 sites when generating events on your site. To do this, it will be necessary to create two different configurations in Tag Composer (one configuration per level 1 site), then to initialize the two Smarttags in order to generate two distinct hits.
In order to avoid any conflict between the initializations of your two configurations, we recommend that you rename your second configuration ("config2" for example) and rename the second version of your tag ("tag2" for example) by implementing the following:
var tag2 = new ATInternet.Tracker.Tag(config2);
To ensure that your marketing campaigns are correctly reported on these two sites, it will be necessary to uncheck the option "Link campaign data to the site domain" in your two configurations from Tag Composer (advanced settings).
