Analytics
2.4K members online now
2.4K members online now
Dive into multiple domain (Cross/Sub) tracking, implementing Ecommerce and Enhanced Ecommerce, setting up Event tracking, and Universal Analytics code.
 
Guide Me
star_border
Reply

Embedding Universal Analytics-trackingcode in Microsoft Word site

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

For practical reasons my sites are develloped in Microsoft Word, simply by saving documents in .html-format and uploading them to my domains through ftp.
The sites are updated frequently. Therefor I pose this question: Is there a way to embed the  Universal Analytics-trackingcode in these documents, other then by pasting the snippet manually? For all clarity, I mean the code similar to this:

 

<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','//www.google-analytics.com/analytics.js','ga');

ga('create', 'GNABBERWOCKY', 'auto');
ga('send', 'pageview');

</script>

 

Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
Marked as Best Answer.
Solution
Accepted by topic author Jaap S
January 2016

Re: Embedding Universal Analytics-trackingcode in Microsoft Word site

Visitor ✭ ✭ ✭
# 3
Visitor ✭ ✭ ✭
Thanks for your reply Oren.
As I have a simple private webserver this solution sounds a bit over the top for me.
Meanwhile I have written a simple Python-script that opens all .html-files involved as text and inserts the Google-snippet before uploading.
An effective solution, that won't win any prizes in a beauty contest.

View solution in original post

Re: Embedding Universal Analytics-trackingcode in Microsoft Word site

Follower ✭ ✭ ☆
# 2
Follower ✭ ✭ ☆
Hi

You should consider using a server side include derective to include the analytics snippets and other snippets in all pages. How to use server side includes depends on your hosting and the server they use.

A more flexible alternative would be to use a serverside include for a google tag manager snipper and then use the container to include and manage your codes independently of the deployment cycle.
Marked as Best Answer.
Solution
Accepted by topic author Jaap S
January 2016

Re: Embedding Universal Analytics-trackingcode in Microsoft Word site

Visitor ✭ ✭ ✭
# 3
Visitor ✭ ✭ ✭
Thanks for your reply Oren.
As I have a simple private webserver this solution sounds a bit over the top for me.
Meanwhile I have written a simple Python-script that opens all .html-files involved as text and inserts the Google-snippet before uploading.
An effective solution, that won't win any prizes in a beauty contest.

Re: Embedding Universal Analytics-trackingcode in Microsoft Word site

Follower ✭ ✭ ☆
# 4
Follower ✭ ✭ ☆
My pleasure.

Keeping things simple is an important!