Adding Third-party Scripts to Your Community (Google Analytics)


Do you want to empower your community with external services such as Google Analytics, Surveymonkey or Optimizely? Read on, because in this How To you’ll learn how to add these with the help of our Third-party Scripts feature.

 

How to add Third-party Scripts to your community

  1. Copy the code from a third-party that you want to add to the community.
  2. Administrators go to ControlCustomizationThird-party Scripts.
  3. Paste the code in the area where you want to add the code: in the <head> after the opening <body> or before the closing </body>
  4. Hit Save changes, and you’re done. The script is now injected globally, in all pages of your community.

 

Examples

How to add Google Analytics to your community

  1. Log in to Google Analytics and go to Admin
  2. In the column Account select an account
  3. In the column Property go to Tracking Info Tracking Code
  4. Copy the tracking code (gtag.js)
  5. Go to ControlCustomizationThird-party Scripts
  6. Paste the code in the <HEAD>area
  7. Hit Save changes, and you’re done. Google Analytics is now added to your community.


How to add Google Tag Manager to your community

  1. Log in to Google Tag Manager and click on your Container Name
  2. Click on the GTM Tracking ID (GTM-123ABC)
  3. Copy the tracking codes (2 codes)
  4. Go to Control CustomizationThird-party Scripts
  5. Paste the code in the < HEAD> area and after < BODY> area
  6. Hit Save changes, and you’re done. Google Tag Manager is now added to your community.

 

Supported services

  • Google Analytics
  • Google Tag Manager
  • Adobe Analytics
  • Atlassian Statuspage
  • Survey Monkey
  • Optimizely
  • Many more…

Note:

  • We recommend to test adding third-party scripts to your staging environment first, before adding scripts to your production community.
  • ​We recommend to add scripts before the closing tag. This way they will have the least impact on your community’s performance.
  • ​​​​​​We recommend inviting a professional web developer to help you add third-party scripts. Use any custom code at your own risk, and proceed with extreme caution — inSided support won’t be able to assist you with issues related to third-party scripts.

13 replies

Hi 😃



This seems a very nice development! I went to Control but I have no such Tab "System Configuration" 🤔



Can you help? Do you need to enable it?
Hey Tomas,



This is only available for branded clients, as on a custom community you've always been able to add custom scripts by submitting a request to the support desk, while up until this point, branded clients could not have any custom scripts unless it was included in their SSI.
Glad we have this, however, having received the code/script from our Dev team, I have pasted it into the Before section but its not showing?



Anyone have any ideas?? The dev team are pretty sure the code base is correct. Am I putting it in the wrong place??



@Julian @Maryam



Darran
Userlevel 2
Badge +3
Hey Darran!



Well some code is supposed to remain hidden. 😃 I could have a look, however as I am not good at coding, I would recommend our mate @tom.shaddock. He probably will find the issue in no-time, I hope he has the time to check it.



Cheers,



Julian
Hey @OVOdarran, I've had a look at your code - it looks as if its been copied and pasted in wrong 🙂. Basically I can see the end of the code doesn't look quite right:



.footer .col-social-med...



That's the last CSS rule in your pasted in code, it looks like the rest of it was truncated for whatever reason and then an ellipsis (...) added in place of the missing code.



Are you able to send me the entire original script via email? I can take a look at it and am happy to apply it to your community if you wanted.



Tom
Hey @tom.shaddock we've worked it out and its now live! Thank god for Dev's!! lol
Hey @OVOdarran glad its working! 😃
Userlevel 1
Badge

Has anyone here used this for Optimizely? 

 

Am I right in thinking this script is meant to make small changes to the page display? 

 

In another related question, is it possible to add two Google Analytics scripts?

Badge

Howdy!

You can indeed have multiple Google Analytics tags active if you wish @timcavey , but only with the new script - the legacy one will break if you try this. So…

:negative_squared_cross_mark: Don’t try it with this one!

<script type="text/javascript">

var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-XXXXX-X']);
_gaq.push(['_trackPageview']);

(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();

</script>

:white_check_mark: Do try it with this one!

<!-- Google Analytics -->
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');

ga('create', 'UA-XXXXX-Y', 'auto');
ga('send', 'pageview');
</script>
<!-- End Google Analytics -->

As for Optimizely, I’ve heard of it and it does indeed do what you think it does. However, it’s worth bearing in mind that we’ve got a mixture of content at play and even to this day, there’s still a few members who use BBCode formatting despite the new editor not officially supporting it - along with some other more complicated non-standard stuff. There is a risk that using Optimizely could break some of those things.As it’s a pretty powerful script, you’ll want to use it carefully too.

The other thing to watch out for, is that inSided changes things on a very rapid basis. Presumably tools like that can handle agile development flows from upstream, but be prepared to turn it off should something go bang. If it’s breaking things really badly, you’ll probably want to shut it down for a while.

Mind you… When I look at the details… I get the feeling it might work better as a direct integration between inSided and Optimizely, or as a native feature within inSided itself.

There is a bit of a Gotcha! however. In my personal experience with my somewhat slow internet connection, Optimizely has historically caused me quite a few headaches when it wasn’t configured properly.

I’ve also run some analysis, done a bit of research and had a think about this next one. As far as I can tell, inSided is very heavily cached for both Static and Dynamic content. While Optimizely can handle Static Caching, it’s not very good with handling Dynamic Caching, which may either prevent the script from working properly, or potentially completely break stuff.

I think it’s probably worth seeing if @tom.shaddock has any thoughts though. Having seen what Optimizely can do when it works well, I’d be curious to see if work with inSided - but only if it won’t break everything!

Userlevel 1
Badge

Thanks @Blastoise186 

 

Howdy!

You can indeed have multiple Google Analytics tags active if you wish @timcavey , but only with the new script - the legacy one will break if you try this. So…

:negative_squared_cross_mark: Don’t try it with this one!

<script type="text/javascript">

var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-XXXXX-X']);
_gaq.push(['_trackPageview']);

(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();

</script>

:white_check_mark: Do try it with this one!

<!-- Google Analytics -->
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');

ga('create', 'UA-XXXXX-Y', 'auto');
ga('send', 'pageview');
</script>
<!-- End Google Analytics -->

 

 

I can see that Google Tags Manager is a third-party script we have, not GA. Which tells me it’s in GTM that I need to add the second GA tags. @Kenneth R anyone over there have the keys to this?

 

 

I get the feeling it might work better as a direct integration between inSided and Optimizely, or as a native feature within inSided itself.

 

 

@Frank what do we think about this? It’s listed as a supported service in the main topic...

 

I think it’s probably worth seeing if @tom.shaddock has any thoughts though. Having seen what Optimizely can do when it works well, I’d be curious to see if work with inSided - but only if it won’t break everything!

 

Yes please Tom! 

Userlevel 1
Badge

@Julian following your intro and advice about GA4 at the first inSided EMEA Office Hours, I’ve not been able to get it any data from our instance. 

 

I’ve added it to our existing GTM as they instructed, alongside our existing GA Universal. Nothing. Have I just done it wrong or will it not display the data but it is collecting? 

 

 

Userlevel 2
Badge +3

So I have just spent another half an hour in the rabbit hole that is GA4 to me, unfortunately without success. 😞 I also performed these steps and still do not see data. I currently see three reasons why this could be the case:

1. Our platform does not send the events that GA4 is looking for

This would require us to do changes in the platform to allow GA4 to measure like the universal GA is doing it. Here I actually performed a step which ensures that GA4 is using the same structure as the universal GA, but this did not seem to help.

2. The way that the GA4 tag is implemented is not sufficient

I did read that there are several ways to add the tag to the website. It could be that the way we are doing it (via Third-Party Scripts) is not supported and therefore the activation fails. What speaks for this theory is that I do not measure anything, what speaks against it is that GA usually indicates when a verification failed.​​​​​​

3. GA4 is requiring us to define segments / audiences before data can be surfaced

I have read several times that GA4 offers much more segmented insights into user behaviour (e.g. first visitor vs. logged in user), it could be that these segments need to be defined first before GA4 actually starts showing data.

I will have some conversations internally and also scour the internet for content that is more tailored to our context. Much of the official content is focussed on webshops / Apps, and this is far from what we are doing / are interested in.

I hope to be able to share more information with you soon!

Userlevel 1
Badge

Thanks @Julian!

 

To help me understand this:

 

2. The way that the GA4 tag is implemented is not sufficient

I did read that there are several ways to add the tag to the website. It could be that the way we are doing it (via Third-Party Scripts) is not supported and therefore the activation fails. What speaks for this theory is that I do not measure anything, what speaks against it is that GA usually indicates when a verification failed.​​​​​​

 

 They provide a step by step guide on adding the GA4 tag via GTM. If GTM is the third party script you refer to, surely these instructions suggest compatibility. 

 

We’re still using Universal so no real rush other than we miss out on GA4 data for this period when it’s next year and Universal is closed down.

 

Is the answer Mixpanel? 

Reply