iam making a set og website i one umbraco installation all3 sites uses the same markup so i only need to do one Master page, as all 3 sites have thear own domain and therfor a trackin ID i like a way to input it from the backen end whit out the ned to edit the master.
i have look i search but i can seam to finde eny treads about it.
i wath way can i make it so XXXXXXXXXXX is input from content end.
If you create a textstring property at the homepage level (in this example called "ga Code"..
Then you can just get the root (homepage) node from within the page and then get the GA Code from there. This is doing it in the master / base template (the @RenderBody calls the child).
I'd usually put all logic in a Partial Macro View but hopefully it will give you the idea.
Please do yourself a favor and make the whole script tag editable (including the <script> tags themselves). At some point an SEO will come and say: “I need to add the line ga('require', 'displayfeatures');. How do I do that?” or the Google Analytics boilerplate will change again, or a marketing campaign calls for a Facebook Pixel code block, etc.
The basic boilerplate code is copy-pasted from Google Analytics anyways. Some SEOs wouldn't know how to extract the property identifier from the code to insert it into your CMS input field.
Google analytics tracking script
Hey,
iam making a set og website i one umbraco installation all3 sites uses the same markup so i only need to do one Master page, as all 3 sites have thear own domain and therfor a trackin ID i like a way to input it from the backen end whit out the ned to edit the master.
i have look i search but i can seam to finde eny treads about it.
i wath way can i make it so XXXXXXXXXXX is input from content end.
Michael
Hi,
If you create a textstring property at the homepage level (in this example called "ga Code"..
Then you can just get the root (homepage) node from within the page and then get the GA Code from there. This is doing it in the master / base template (the @RenderBody calls the child).
I'd usually put all logic in a Partial Macro View but hopefully it will give you the idea.
Please do yourself a favor and make the whole script tag editable (including the
<script>
tags themselves). At some point an SEO will come and say: “I need to add the linega('require', 'displayfeatures');
. How do I do that?” or the Google Analytics boilerplate will change again, or a marketing campaign calls for a Facebook Pixel code block, etc.The basic boilerplate code is copy-pasted from Google Analytics anyways. Some SEOs wouldn't know how to extract the property identifier from the code to insert it into your CMS input field.
is working on a reply...