Wiki

Clone wiki

kay_admob / Home

Kay AdMob

About:

AdMob specializes in ads and analytics for mobile websites. Kay AdMob is a pluggable application for Kay Framework (http:bitbucket.org/tmatsuo/kay/) on Google App Engine to help you get up and running with AdMob quickly. Kay AdMob is based off the Django AdMob (http:github.com/johnboxall/django_admob).

Sample Kay App with Kay AdMob available at https:bitbucket.org/victorgoh/kay-admob-sample.

Usage in a Kay project:

1. Add the following in your settings.py:

"""
ADMOB Settings
"""
ADMOB_PUBLISHER_ID = 'publisher_id' 
ADMOB_ANALYTICS_ID = 'analytics_id' 
ADMOB_COOKIE_PATH = '/' 
ADMOB_COOKIE_DOMAIN = '.example.com' 
ADMOB_ENCODING = 'utf-8' 
ADMOB_TEST = True

"""
End ADMOB Settings
"""

INSTALLED_APPS = (
  ...
  'kay_admob',
)

JINJA2_EXTENSIONS = (
  'kay_admob.extensions.AdMobExtension',
)

MIDDLEWARE_CLASSES = (
  'kay.sessions.middleware.SessionMiddleware',
  ...
  'kay_admob.middleware.AdMobMiddleware',
)

2. Sample Jinja Template with the admob tag:

<html>
<head>
	<title>Mobile page title</title>
</head>
<body>
{% admob %} <!-- display Admob ad here -->
<h1>Mobile page title</h1>
<p>{{ content }}</p>
</body>
</html>

3. To use analytics decorator on a view:

from kay_admob.decorators import admob_analytics as analytics

@analytics
def index(request):
	...

Updated