Expand my Community achievements bar.

SOLVED

Retreieve datastreamID and set it

Avatar

Level 3

Hi all, 

 

i'd like to know if there is any way to change the datastreamId where the data are sent during the elaboration of some conditions. 

 

Is there a way to detect the datastream and then change it, maybe inside a rule? 

 

Thanks in advance!

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

I see that you are asking about "dataStreamId" and not "dataSetId".   

 

The dataStream is selected (per Launch environment) in the AEP Web SDK main configuration.  This setting is tied to the "instance" - most people only have one instance and take the default instance name of "alloy". 

 

What you're asking to do seems possible, but also pretty complicated.  Here's how I see it as being possible. 

 

It is possible to have multiple AEP Web SDK instances (each with different data stream settings). 

Let's say that you create two instances and name them "alloy A" and "alloy B". 

"alloy A" sends data to the edge using dataStream A (which in turn populates AA Report Suite A). 

"alloy B" sends data to the edge using dataStream B (which in turn populates AA Report Suite B). 

 

You can create a rule with the appropriate conditions that does an XDM Send using the "alloy A" instance.  You can then create an other rule with (hopefully mutually exclusive) conditions that does an XDM Send using "alloy B".  I think that I'd include some indication of the instance in the rule name so that you can keep things straight in the UI. 

 

IDK if this is an appropriate solution for you, but it's a solution nonetheless.

 

 

View solution in original post

10 Replies

Avatar

Community Advisor

Hello @nico9 

 

You can select the data set where you want to ingest the data in the launch rule.

 

Here is the screenshot where you can add the data set id.

Manoj_Kumar__0-1656655449745.png

 


     Manoj
     Find me on LinkedIn

Avatar

Level 3

Thanks for the answer!

unfortunately it seems to be a little more complicated as i want to change not only the dataset but actually also the reportsuite for analytics. so i'd like to send certain data to a datastream with different configurations.

Avatar

Community Advisor

The "Dataset ID" field that @_Manoj_Kumar_ mentioned can accept a data element. So you can have a data element that returns the dataset ID that you need, and use that data element in this Web SDK action.

Avatar

Correct answer by
Community Advisor

I see that you are asking about "dataStreamId" and not "dataSetId".   

 

The dataStream is selected (per Launch environment) in the AEP Web SDK main configuration.  This setting is tied to the "instance" - most people only have one instance and take the default instance name of "alloy". 

 

What you're asking to do seems possible, but also pretty complicated.  Here's how I see it as being possible. 

 

It is possible to have multiple AEP Web SDK instances (each with different data stream settings). 

Let's say that you create two instances and name them "alloy A" and "alloy B". 

"alloy A" sends data to the edge using dataStream A (which in turn populates AA Report Suite A). 

"alloy B" sends data to the edge using dataStream B (which in turn populates AA Report Suite B). 

 

You can create a rule with the appropriate conditions that does an XDM Send using the "alloy A" instance.  You can then create an other rule with (hopefully mutually exclusive) conditions that does an XDM Send using "alloy B".  I think that I'd include some indication of the instance in the rule name so that you can keep things straight in the UI. 

 

IDK if this is an appropriate solution for you, but it's a solution nonetheless.

 

 

Avatar

Level 2

@Stewart_Schilling I have similar scenario but while creating multiple instances  of Web SDK, it isn't allowing that due to same orgID. Is there any workaround for this?

Avatar

Community Advisor

Hmmm...  I thought that the unique orgId thing might be just a UI restriction but as you see below, it's enforced even when using the bare alloy.js library. 

Screenshot 2023-03-15 at 8.09.52 AM.png

I'm not sure when this restriction came into being, but I'm certain that I tested the use of multiple instances under the same orgId at some point in the past (perhaps it was during the alpha or beta period). 

 

@Parm2 - What is your exact scenario? 

 

Avatar

Level 2

This is my scenario to track multiple business sites for an organization to have common data layer and common visitor identification but send data to their respective reportsuites.

SiteTracking.png

Avatar

Community Advisor

Ok,  So for a given website, the report suite would always be the same? 

If that is the case, then you could create data elements that return the datastream identifier based on document.location.pathname.  You could have three datastreams, each configured for a given business site (with a different report suite).  In the AEP WEB SDK extension configuration, you can use data elements to provide the datastream id for production, staging, and development environments. 

 

Screenshot 2023-03-15 at 4.03.13 PM.png

You could actually use just one data element (Core -> custom code) that would look something like this: 

const dsMap = {
  "_development":  "<enter datastream id>",
  "_staging": "<enter datastream id>",
  "_production": "<enter datastream id>",
  "xyz_development":  "<enter datastream id>",
  "xyz_staging": "<enter datastream id>",
  "xyz_production": "<enter datastream id>",
  "pdr_development":  "<enter datastream id>",
  "pdr_staging": "<enter datastream id>",
  "pdr_production": "<enter datastream id>"
}
const key = `${document.location.pathname.split("/")[1]}_${_satellite.environment.stage}`;
return dsMap[key]||"NO DS MAP";

Note that this will set the datastream for the alloy instance.  This will be fine as long at the alloy instance is created when each site loads (if the sub-sites are part of a larger SPA, then this might not work for you).  

Avatar

Level 2

Yes for a given site the reportsuite will be same. 

 

I considered this option but I see few issues with this:

  1. All the 3 websites will have different WebSDK javascript as per envn these are configured for. Aren’t the envn for datastreams in SDK tied to envn in Publishing?
  2. In case the websites are more than 3, it will be an issue
  3. The code deployment post testing in dev to staging to prod will not be possible as each envn will have a different website associated with it