Overview

In Omeka S, there is a module called Google Analytics for enabling Google Analytics.

https://github.com/Libnamic/Omeka-S-GoogleAnalytics/

When enabling this module, there were cases where the following error message was displayed.

Undefined index: additional_snippet in (...) /modules/GoogleAnalytics/Module.php on line 316

The following issue had also been raised regarding this.

https://github.com/Libnamic/Omeka-S-GoogleAnalytics/issues/9

I will share the method for addressing this issue.

Fix Method

Make the following changes.

https://github.com/Libnamic/Omeka-S-GoogleAnalytics/pull/10/commits/0123ce557d0f38834c5c37fa1ac9c986c87cbc90

Specifically, the changes are as follows.

Before

i}i}ff((e$$ie$$imssfmssfpeepeettt(ttt(ytt$$ytt$$(iise(iise$nnex$nnexeggtteggttxsstrxsstrtiatiar==n_r==n_agsags_$$sn_$$snstsistsinhe!pnhe!piit=piit=ppstepstep-intp-inte>nue>nutggl=tggl=)esl)esl)t-)$)t-)$S>sS>s{ege{egeretretvttvtti(ii(ic'nc'neggeggLosLosoo[oo[cg'cg'alaalatedtedoadoadrnirni(at(at)li)li-yo-yo>tn>tngiagiaecleclts_ts_('s('s',n',nOiOimpmpepepk)ek)ea;ta;t\'\'S]S]e;e;ttttiinnggss''));;

After

i}i}ff((e$$ie$$imssfmssfpeepeettt(ttt(ytt$i}}ytt$i}}(iisf(iisf$nnee$nneeeggtA(leggtA(lxsstsi$s$xsstsi$s$tisseeetisseeer==nusxxr==nusxxagmet{tagmet{t_$$sitrr_$$sitrrstsn(aastsn(aanhe!g$__nhe!g$__iit=sssiit=ssspsttennpsttennp-inhtiip-inhtiie>nuitppe>nuitpptgglsipptgglsipp)eslnee)eslnee)t-)igtt)t-)igttS>ssS>ss{eg[=={eg[==rep'rep'vtaa$vtaa$i(rds'i(rds'c'tde;c'tde;egitegitLoottLoottoofiioofiicgoncgonaltngDaltngDtehasetehaseoael[foael[frn_'arn_'a(acsau(acsau)londl)londl-ydidt-ydidt>tepi>tepigiptvgiptvecweiaecweiatshtoltshtol('e'nu('e'nu',r]ae',r]aeOe)lOe)lm_im_iey&sfey&sfk)o&nk)o&na;ui'a;ui'\!pa\!paShepdShepdeamedeamedtnptitnptitdt'ttdt'tily]iily]ine(;one(;og$ng$nstsastsa'hel'hel)et_)et_;ts;tseineinxnixnitgptgprsprspa[ea[e't'tsa'sa'ndndidkidkpiepieptyptyeieitoitoinsnsaalnln_o_oststnnisispepeptpteett'']])))){{

Summary

I am not entirely confident that the above changes are completely correct, but I have also submitted a pull request.

https://github.com/Libnamic/Omeka-S-GoogleAnalytics/pull/10

I hope this serves as a useful reference.