{jr_google_analytics}
The {jr_google_analytics} function is used for embedding the proper HTML and Javascript into a Jamroom Template so it records information for Google Analytics.
Parameters
Name |
Type |
Required |
Default |
Description |
id |
string |
no |
Config Setting |
By default, the {jr_google_analytics} Template Function will use the Google Analytics ID entered into the Jamroom Config -> System Settings Section. If you would like to "override" this ID with an alternate ID, you can give it to the function using the "id" parameter. |
page |
string |
no |
n/a |
By default, Google Analytics will figure out the name of the page to use in the Analytics tracking, but if you want to specify an alternate name, you can pass that name in via the "page" parameter. |
assign |
string |
no |
n/a |
When the {jr_google_analytics} Template Function is run (that is the template it is embedded in is viewed), the HTML and Javascript code generated can be "stored" in a variable for use later in the template. The name given to the "assign" function will be the name of the variable that can then be accessed in the template.
Note: assign only works in Skin templates - not Profile Theme templates. |
Configuration
All of the Jamroom Skins that are provided by Jamroom.net support Google Analytics "out of the box". To "enable" the Google Analytics code, go to the Jamroom Config -> System Settings section and enter your Google Analytics ID:
Examples
Example embedding the {jr_google_analytics} template function into a Skin template:
Example embedding the {jr_google_analytics} template function into a Skin template and specifying an alternate Google Analytics ID:
{jr_google_analytics id="UA-246735-2"} |
Customization - allowing your Artist and Members to use their own Analytics ID
If you would like to allow your Artist and Member profiles the ability to "track" their own hits to their pages using Google Analytics, here is a small guide on how to do it:
- The first step is to create a Custom Form Field in the Artist Form for "band_google_analytics".
- Log in to your Jamroom as the Master Admin.
- Click on "Jamroom Config"
- Click on "Custom Form Fields"
- Click on "Artist Profile"
- Near the bottom of the form where it says "New Field", enter:
- "band_google_analytics" for the TITLE.
- Select "Input Field" for the TYPE.
- Select "All Quotas" for the QUOTA.
- Save the new Custom Form Field by pressing the Save Changes button.
- The second step is to add the {jr_google_analytics} function call to the theme_footer.tpl file:
- Log in to your Jamroom as the Master Admin.
- Click on "Jamroom Tools"
- Click on "Template Editor"
- In the "Search Templates" field, enter "theme_footer". Make sure you place a checkmark in the "Search File Name Only" Search Option, and press the "Search" button
- From the list of returned results, select the theme_footer.tpl file you would like to add the tracking to, and press the "Edit Template" button.
- Once editing the Template, you will want to scroll to the bottom where you see a {$HIDDEN_COUNTER} variable:
</body>
</html>
{$HIDDEN_COUNTER}
{/jr_unique_block}
Change it to:
</body>
</html>
{jr_google_analytics id=$BAND_GOOGLE_ANALYTICS}
{$HIDDEN_COUNTER}
{/jr_unique_block}
Then save the file and you are all set! Now your Artist and Member profiles can enter their own Google Analytics ID in their profile and track their own page views.
|