Skip to main content
Question

JS integration for in-app messages overlap with Segment analytics


Hi,
I would like to enable the in-app messages feature on an application in which we also run Segment analytics: I have noticed that both the JS snippet from Segment and the one from Customer.io add an `analytics` object and the same methods.

 

To add more, this is Segment:

<script>
!function(){var i="analytics",analytics=window[i]=window[i]||[];if(!analytics.initialize)if(analytics.invoked)window.console&&console.error&&console.error("Segment snippet included twice.");else{analytics.invoked=!0;analytics.methods=["trackSubmit","trackClick","trackLink","trackForm","pageview","identify","reset","group","track","ready","alias","debug","page","screen","once","off","on","addSourceMiddleware","addIntegrationMiddleware","setAnonymousId","addDestinationMiddleware","register"];

// ...
</script>

This is customer.io:

 <script>
 !function(){var i="cioanalytics", analytics=(window[i]=window[i]||[]);if(!analytics.initialize)if(analytics.invoked)window.console&&console.error&&console.error("Snippet included twice.");else{analytics.invoked=!0;analytics.methods=["trackSubmit","trackClick","trackLink","trackForm","pageview","identify","reset","group","track","ready","alias","debug","page","once","off","on","addSourceMiddleware","addIntegrationMiddleware","setAnonymousId","addDestinationMiddleware"];

// ...
 </script>

 

They look to be the same scripts: they create an object `analytics` and the same methods list:

["trackSubmit","trackClick","trackLink","trackForm","pageview","identify","reset","group","track","ready","alias","debug","page","screen","once","off","on","addSourceMiddleware","addIntegrationMiddleware","setAnonymousId","addDestinationMiddleware","register"];

with a very few differences: I am worried that adding the JS snipper from customer.io would override the one from Segment. What would be the correct way to add the customer.io snippet? I would add it as Segment integration, but I can see here that the in-app messages feature cannot be enabled in that way.

 

Thank you,
Luca

0 replies

Be the first to reply!

Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings