Hi Justin I’ve no experience with Google Optimize, but those mods to the googleanalytics.js file look OK. The easiest way to make these changes in the browser would be to create a tiddler that overrides the shadow tiddler containing the original code:
1. Install the core Google Analytics plugin via the control panel plugin tab 2. Find the tiddler "$:/plugins/tiddlywiki/googleanalytics/googleanalytics.js” using the “shadows” tab in advanced search 3. Edit it, replacing the text with your modified version 4. Save the tiddler 5. Save the wiki and reload Best wishes Jeremy. > On 30 May 2018, at 08:21, [email protected] wrote: > > I am looking into utilizing TiddlyWiki as a web tree testing platform. To > accomplish this, I'm trying to incorporate Google Analytics and Google > Optimize. Google Optimize requires a slightly modified version of Google > Analytics in order to be used on a site. The jermolene plugin > <https://github.com/Jermolene/TiddlyWiki5/tree/master/plugins/tiddlywiki/googleanalytics> > would need some slight modifications in order to accommodate this. I would > imagine this: > /*\ > title: $:/plugins/tiddlywiki/googleanalytics/googleanalytics.js > type: application/javascript > module-type: startup > Runs Google Analytics with the account number in the tiddler > `$:/GoogleAnalyticsAccount` and the domain name in `$:/GoogleAnalyticsDomain` > \*/ > (function(){ > > /*jslint node: true, browser: true */ > /*global $tw: false */ > "use strict"; > > // Export name and synchronous status > exports.name = "google-analytics"; > exports.platforms = ["browser"]; > exports.synchronous = true; > > exports.startup = function() { > // getting parameters > var GA_ACCOUNT = > $tw.wiki.getTiddlerText("$:/GoogleAnalyticsAccount","").replace(/\n/g,""), > GA_DOMAIN = > $tw.wiki.getTiddlerText("$:/GoogleAnalyticsDomain","").replace(/\n/g,""); > if (GA_DOMAIN == "" || GA_DOMAIN == undefined) GA_DOMAIN = "auto"; > > // using ga "isogram" function > (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', GA_ACCOUNT, GA_DOMAIN); > ga('send', 'pageview'); > }; > > })();// JavaScript Document > > would just need to become something like: > /*\ > title: $:/plugins/tiddlywiki/googleanalytics/googleanalytics.js > type: application/javascript > module-type: startup > Runs Google Analytics with the account number in the tiddler > `$:/GoogleAnalyticsAccount` and the domain name in `$:/GoogleAnalyticsDomain` > \*/ > (function(){ > > /*jslint node: true, browser: true */ > /*global $tw: false */ > "use strict"; > > // Export name and synchronous status > exports.name = "google-analytics"; > exports.platforms = ["browser"]; > exports.synchronous = true; > > exports.startup = function() { > // getting parameters > var GA_ACCOUNT = > $tw.wiki.getTiddlerText("$:/GoogleAnalyticsAccount","").replace(/\n/g,""), > GO_ACCOUNT = > $tw.wiki.getTiddlerText("$:/GoogleOptimizeAccount","").replace(/\n/g,""), > GA_DOMAIN = > $tw.wiki.getTiddlerText("$:/GoogleAnalyticsDomain","").replace(/\n/g,""); > if (GA_DOMAIN == "" || GA_DOMAIN == undefined) GA_DOMAIN = "auto"; > > // using ga "isogram" function > (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', GA_ACCOUNT, GA_DOMAIN); > ga('send', 'pageview'); > ga('require', GO_ACCOUNT); > }; > > })();// JavaScript Document > (changes highlighted) > > Is the way I'm looking at this fit into how TiddlyWiki works (I'm still new > to it)? Is this a change I could implement myself? I can't seem to find a > beginner's guide to modifying and uploading a customized plugin, which leads > me to believe it isn't a beginner's sort of task. Simply saving this as a JS > and dragging it in didn't prove effective. Any help or direction is greatly > appreciated. > > Thanks all! > > -Justin > > > -- > You received this message because you are subscribed to the Google Groups > "TiddlyWiki" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected] > <mailto:[email protected]>. > To post to this group, send email to [email protected] > <mailto:[email protected]>. > Visit this group at https://groups.google.com/group/tiddlywiki > <https://groups.google.com/group/tiddlywiki>. > To view this discussion on the web visit > https://groups.google.com/d/msgid/tiddlywiki/7a749a53-eba6-4d31-b6f8-25c3842e31f8%40googlegroups.com > > <https://groups.google.com/d/msgid/tiddlywiki/7a749a53-eba6-4d31-b6f8-25c3842e31f8%40googlegroups.com?utm_medium=email&utm_source=footer>. > For more options, visit https://groups.google.com/d/optout > <https://groups.google.com/d/optout>. -- You received this message because you are subscribed to the Google Groups "TiddlyWiki" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/tiddlywiki. To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/D45BF2E0-2A01-4888-A95D-E0D7B50148A7%40gmail.com. For more options, visit https://groups.google.com/d/optout.

