Added settings key and removed need to use quoted template tag arguments #10
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I modified this app in order to suit my needs, and thought I might as well share my modifications. They can be considered add-ons only, as the app stil retains all of its current functionality. I didn't want to put my GA account code in my template, so I thought I'd just supply the analytics template tag with a variable holding my key. That didn't work since the tag required input to be quoted in double quotes. I therefore ended up making the following to modifications to the app:
GOOGLE_ANALYTICS_KEY
is present in your project its value will be used as code by the template tag if no code is supplied. At the moment this setting also takes precedence over the Sites-framework based solution (as that is what suited my needs).This has the following implications (improvements if you ask me):
{% analytics %}
will return the code specified insettings.GOOGLE_ANALYTICS_KEY
if present, and otherwise use the Sites framework.{% analytics my_code %}
is now also an options (my_code
being a template variable holding the code).{% analytics "UA-123456-7" %}
still works fine, as does{% analytics 'UA-123456-7' %}
and{% analytics UA-123456-7 %}
.