Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Adding Google Analytics to Mobile
Smitty
New
I have used pockets to insert my Google Analytics code into my forum theme and it works great (unless it does something i don't know about)... but I'm having trouble with doing this for the mobile version.
I realize there are some add-ons out there that might be able to accomplish this, but unless one is approved by Vanilla Forums, I prefer to just paste my google analytics code into a header some place (of my mobile theme).
Can anyone help me insert GA tracking code into my mobile theme? I tried on the default.master.tpl, but got BONK.
Thanks!
0
Comments
you need to insert script within
{literal}{/literal}
tagsor smarty will try to parse it.
please search for 'Bonk' next time to know what to do, when that happens.
grep is your friend.
You can try my plugin http://vanillaforums.org/addon/advancedgoogleanalytics-plugin
It embed the latest version of the google analytics code and works without editing any files (Tested only with >2.1). If you have vanilla 2.0.x edit the class file changing the line
'RequiredApplications' => array('Vanilla' => '2.1a1'),
to'RequiredApplications' => array('Vanilla' => '2.0'),
.If you encounter any problem, just ask.
There was an error rendering this rich post.
Considering all the help you receive on this forum is not approved by Vanilla, I find this funny.
That said, you might find it helpful to read the wiki on .tpl files and working with smarty.
Welcome to the community!
Search first
Check out the Documentation! We are always looking for new content and pull requests.
Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.
This is another good reason to turn the unapproved warning into a rating system. The warning can be in tiny letter somewhere not easy to find.....
❌ ✊ ♥. ¸. ••. ¸♥¸. ••. ¸♥ ✊ ❌
I don't see literal tags on my default.master.tpl file. I use this theme: Embed-Friendlyversion 1.0
@Smitty Excerpt from the wiki article on smarty tags:
This means you need to sandwich your google analytics javascript in between the
{literal}
and{/literal}
tags.Search first
Check out the Documentation! We are always looking for new content and pull requests.
Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.
Wow, much appreciated on the details. This may be a dumb question, but what is "smarty". If it wasn't already included, I doubt I downloaded it (if it's a plugin, etc). So curious if I need to? Your solution {literal} worked without me having to do anything else, though, so I assume all is well?
Thanks again!
Smarty is a template engine for PHP.
http://www.smarty.net/docsv2/en/what.is.smarty.tpl
❌ ✊ ♥. ¸. ••. ¸♥¸. ••. ¸♥ ✊ ❌
Great, thanks. I will read up on it. But given the fix above worked, and I do not have Smarty, I don't need Smarty, then right?
Thanks again, everyone. This community is very helpful, and fast to reply!
Well you already have Smarty , plus if the theme's master view is a tpl , then it uses Smarty which is in your library under vendors.
❌ ✊ ♥. ¸. ••. ¸♥¸. ••. ¸♥ ✊ ❌
Smarty is the template system that processes your theme's
default.master.tpl
file. If you look at yourdefault.master.tpl
file, you will see a few different words enclosed in curly braces. E.g.{asset name="content"}
. Smarty takes these tags and fills them in with dynamic content. So your category view gets a list of discussions in a specific category, a discussion shows all the related comments, etc.Search first
Check out the Documentation! We are always looking for new content and pull requests.
Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.
Thanks for all the help. Thanks even more for having such a helpful approach. So many support forums out there have helpful people, but they seem drained and annoyed helping those just learning the product. Refreshing!
Give it time .... lol
❌ ✊ ♥. ¸. ••. ¸♥¸. ••. ¸♥ ✊ ❌
@Smitty
Just don't ask about Bonk!