# Adding Google Analytics to Knack

**URL:** <https://forums.knack.com/t/adding-google-analytics-to-knack/8500>\
**Category:** Ask Developers\
**Created:** [March 18, 2020, 2:36am UTC](https://forums.knack.com/t/adding-google-analytics-to-knack/8500 "2020-03-18T02:36:54Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![PromiseTea14608](https://sea2.discourse-cdn.com/flex020/user_avatar/forums.knack.com/promisetea14608/32/340_2.png) [@PromiseTea14608](https://forums.knack.com/u/PromiseTea14608)\
**Post date:** [March 18, 2020, 2:36am UTC](https://forums.knack.com/t/adding-google-analytics-to-knack/8500/1 "2020-03-18T02:36:54Z")

</div>

I'm trying to add Google Analytics to my knack app. I tried following the post guides here, but when my knack javascript gets run, $('#knack-body') doesn't exist, so my google analytics script never gets run. Where is the element with id 'knack-body'?

---

<div class="post-metadata">

**Author:** ![hmnd](https://sea2.discourse-cdn.com/flex020/user_avatar/forums.knack.com/hmnd/32/190_2.png) [@hmnd](https://forums.knack.com/u/hmnd)\
**Post date:** [March 29, 2020, 3:41am UTC](https://forums.knack.com/t/adding-google-analytics-to-knack/8500/2 "2020-03-29T03:41:04Z")

</div>

Hey there,

There's actually no need to do anything with #knack-body. You can simply put [this](https://gist.github.com/hmnd/5d06856e4dec5edc6cecd69dd3d5f61c) in your app's JavaScript, replacing UA-XXXXX-Y with your Google Analytics Tracking ID.

If you would like further help with this or anything else, feel free to contact me at&nbsp;[david@hmnd.io](mailto:david@hmnd.io)! :)

(if the link above does not work, try: [https://gist.github.com/hmnd/5d06856e4dec5edc6cecd69dd3d5f61c](https://gist.github.com/hmnd/5d06856e4dec5edc6cecd69dd3d5f61c))
