getInstance
- Topics:
- Identities
- Integrations
CREATED FOR:
- Developer
- User
- Admin
- Leader
getInstance returns a visitor ID object for the specified Experience Cloud organization ID. This is required to initialize the visitor ID object provided to AppMeasurement through s.visitor.
Syntax
JavaScript
var visitor = Visitor.getInstance("INSERT-MARKETING-CLOUD-ORGANIZATION-ID-HERE", {
trackingServer: "INSERT-TRACKING-SERVER-HERE", // same as s.trackingServer
trackingServerSecure: "INSERT-SECURE-TRACKING-SERVER-HERE", // same as s.trackingServerSecure
// To enable CNAME support, add the following configuration variables
// If you are not using CNAME, DO NOT include these variables
marketingCloudServer: "INSERT-TRACKING-SERVER-HERE",
marketingCloudServerSecure: "INSERT-SECURE-TRACKING-SERVER-HERE" // same as s.trackingServerSecure
});
var visitor = new Visitor
. You must use the proper function call noted here. Applies to VisitorAPI.js code library v3.0 or higher.ActionScript / Flash
import com.adobe.mc.Visitor;
...
var visitor = Visitor.getInstance("INSERT-MARKETING-CLOUD-ORGANIZATION-ID-HERE", {
trackingServer: "INSERT-TRACKING-SERVER-HERE", // same as s.trackingServer
trackingServerSecure: "INSERT-SECURE-TRACKING-SERVER-HERE", // same as s.trackingServerSecure
// To enable CNAME support, add the following configuration variables
// If you are not using CNAME, DO NOT include these variables
marketingCloudServer: "INSERT-TRACKING-SERVER-HERE",
marketingCloudServerSecure: "INSERT-SECURE-TRACKING-SERVER-HERE" // same as s.trackingServerSecure
});
If getInstance
doesn’t find an existing instance, an new instance is created and returned. This is similar to the s_gi()
functionin AppMeasurement.
Common Use
The Experience Cloud ID service API maintains a list of all instances created for each Adobe Experience Cloud organization ID. If the application using the ID service API isn’t passing around a reference to the instance, it can find that instance by calling getInstance
instead of creating a new one. This also provides support for multiple instances for different organizations in the same web page or application.
This is useful for applications that don’t have a clear init
phase, but need to call into the ID service API in multiple places. You can call getInstance
in all of those places and the first to execute will create the instance. The existing instance will be returned by subsequent calls.
Experience Cloud Services
- Identity Service Help
- Overview
- Implementation
- Implementation methods
- Implementation guides
- Implement with Experience Platform tags
- Implement for Analytics
- Implement for Target
- Implement for Analytics and Audience Manager
- Implement for Analytics, Audience Manager, and Target
- Using the ID Service with A4T and a Server-side Implementation of Target
- Direct Integration with the ID Service
- Direct Integration Use Cases
- Test and verify the ID Service
- Opt-in Service
- ID Service API
- ID Service API Overview
- Configuration
- Configurations overview
- audienceManagerServer and audienceManagerServerSecure
- cookieDomain
- cookieLifetime
- disableIdSyncs
- disableThirdPartyCalls
- disableThirdPartyCookies
- idSyncAttachIframeOnWindowLoad
- idSyncContainerID
- idSyncSSLUseAkamai
- loadTimeout
- overwriteCrossDomainMCIDAndAID
- resetBeforeVersion
- sdidParamExpiry
- Secure and SameSite configurations
- secureCookie
- useCORSOnly
- whitelistParentDomain and whitelistIframeDomains
- Methods
- Methods
- appendSupplementalDataIDTo
- appendVisitorIDsTo (Cross-Domain Tracking)
- callTimeOut Methods
- ID Synchronization by URL or Data Source
- getInstance
- getAnalyticsVisitorID
- getCustomerIDs
- setCustomerIDs
- getMarketingCloudVisitorID
- getLocationHint
- getVisitorValues
- isClientSideMarketingCloudVisitorID
- resetState
- Reference
- Reference Overview
- Analytics Reference
- Analytics Reference Overview
- CNAME Implementation Overview
- Setting Analytics and Experience Cloud IDs
- Order of Operations for Analytics IDs
- ID Service Migration Decision Points
- ID Service Migration Scenarios
- Analytics and Identity Requests
- Server-side Implementation Mixed with JavaScript
- The ID Service Grace Period
- Google Chrome SameSite labelling changes
- Content Security Policies and the ID Service
- COPPA Support in the ID Service
- CORS Support in the ID Service
- Customer IDs and Authentication States
- ECID library methods in a Safari ITP world
- Identifying Unique Visitors
- Get Region and User IDs From the AMCV Cookie or the ID Service
- Requirements for the ID Service
- Video Heartbeat and the ID Service
- Data Workbench and the ID Service
- SHA256 Hashing Support for setCustomerIDs
- FAQs
- Release notes for ID Service
Connect with Experience League at Summit!
Get front-row access to top sessions, hands-on activities, and networking—wherever you are!
Learn more