Developers
Ad-blocking technologies sometimes block mParticle tags and event collection endpoints. To prevent blocking and ensure maximum data collection, configure a first-party domain for event collection, and use it instead of the SDK default mparticle.com
domain.
To prevent this blocked HTTP traffic, create a custom subdomain and point that DNS record to mParticle. Traffic is less likely to be blocked because the domain used for mParticle traffic matches the root domain in your app.
Use this process to create a custom subdomain and point the DNS record to mParticle:
mp.mydomain.com
or mparticle.mydomain.com
. To contact mParticle, visit the mParticle Support site and submit a request.mydomain.com
in this example) has been configured previously, Fastly will need to obtain permission from the account owner or authorized point of contact prior to allowing mParticle to complete provisioning. In this case, an additional TXT DNS record will need to be created. Further details will be provided by mParticle at such time.// The Godaddy and LetsEncrypt root certificates that mParticle uses are already included so the following lines are only needed if you are using your own custom certificate provider.
val certificates = mutableListOf(
Certificate.with("rootca", "certificate provided by mParticle"))
val networkOptions = NetworkOptions.builder()
.addDomainMapping(
DomainMapping.configMapping("custom CNAME mapping to config2.mparticle.com/v4", true)
.setCertificates(certificates)
.build()
)
.addDomainMapping(
DomainMapping.eventsMapping("custom CNAME mapping to nativesdks.mparticle.com/v2", true)
.setCertificates(certificates)
.build()
)
.addDomainMapping(
DomainMapping.identityMapping("custom CNAME mapping to identity.mparticle.com/v1", true)
.setCertificates(certificates)
.build()
)
.addDomainMapping(
DomainMapping.aliasMapping("custom CNAME mapping to nativesdks.mparticle.com/v1/identity", true)
.setCertificates(certificates)
.build()
)
.build()
val options = MParticleOptions.builder(this)
.credentials({API-KEY}, {API-SECRET})
.networkOptions(networkOptions)
.build()
MParticle.start(options)
Was this page helpful?