Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at

  • Eugen 30 posts 131 karma points
    Oct 25, 2018 @ 08:45

    Plugin to add Google Analytics' Code to Page

    Hi guys, I'm new in UmbracoCMS. I need to create a portable plugin. When it is installed, a new section is created in the column where the sections "Content" etc. This new section contains dashboard. Dashboard contains textbox with label 'Code' and button with text 'Save'. When the 'Code' is entered and the button 'Save' is pressed then for all pages when rendering is added Google Analytycs Code with saved code.

    Where do I start and which way to go? thanks for the help

  • Alex Skrypnyk 5834 posts 22246 karma points MVP 4x admin c-trib
    Oct 25, 2018 @ 11:05
    Alex Skrypnyk

    Hello Eugen

    Question is how to add needed code to all pages to site that you installed the package.

    It's like you need to edit templates code and needed scripts after, I wouldn't recommend do it.



  • Søren Gregersen 354 posts 1427 karma points MVP 2x c-trib
    Oct 25, 2018 @ 11:10
    Søren Gregersen

    Hi Eugen,

    Normally we implement this by having a setting on the root node of the website. On all pages, we then refer the root node, and read the code and render it if present. The settings can also be implemented in a settings node that may be created under the site, the same way other content (ie. pages) are created.

    This way we just need to add a property instead of creating a new section. You would also need somewhere to store the content if you create a custom section. The solution described above is much simpler.

  • Michaël Vanbrabandt 863 posts 3343 karma points c-trib
    Oct 25, 2018 @ 11:16
    Michaël Vanbrabandt
  • Eugen 30 posts 131 karma points
    Oct 28, 2018 @ 11:05

    Unfortunately i didn't get an answer there. In my project, I created a folder 'Plugin' in which I added files for the plugin. When I create a plugin and as a source I use this folder and then install the plugin (.zip file), the plugin works. And thanks to the debugger VisualStudios, I found that the 'Plugin' folder is working and not the files from .zip. When I install a plugin (.zip) into another project, nothing works. Why is that ?

Please Sign in or register to post replies

Write your reply to: