Skip to content

Commit

Permalink
added clarity in studio (#516)
Browse files Browse the repository at this point in the history
  • Loading branch information
muhammadali124 authored Mar 4, 2024
1 parent ba27aaf commit 7a58e05
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 1 deletion.
3 changes: 3 additions & 0 deletions cms/envs/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -2476,3 +2476,6 @@

# OPEN AI API KEY
OPENAI_SECRET_KEY = 'set-secret-key'

# MS CLARITY PROJECT ID
CLARITY_PROJECT_ID = 'replace-me'
6 changes: 6 additions & 0 deletions cms/envs/production.py
Original file line number Diff line number Diff line change
Expand Up @@ -600,3 +600,9 @@ def get_env_setting(setting):
'USETIFUL_PROJECT_TOKEN',
None
)

# MS CLARITY PROJECT ID
CLARITY_PROJECT_ID = ENV_TOKENS.get(
'CLARITY_PROJECT_ID',
CLARITY_PROJECT_ID
)
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export function CourseOrLibraryListing(props) {
},
body: JSON.stringify(requestData),
});
clarity('set', 'has_viewed_course', 'true');
};

return (
Expand Down
9 changes: 8 additions & 1 deletion cms/templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ <h3 class="title">${_("Create a New Course")}</h3>
'screen_name': 'studio_home',
'organization': '${platform_name}',
}
); sendTracking({'has_created_course':'true'}); CourseLimitRedirect();"
); sendTracking({'has_created_course':'true'}); CourseLimitRedirect(); clarity('set', 'has_created_course', 'true');"
/>
<input type="button" value="${_('Cancel')}" class="action action-secondary action-cancel new-course-cancel" />
</div>
Expand Down Expand Up @@ -611,6 +611,13 @@ <h3 class="title title-3">${_('Need help?')}</h3>
</div>

<script>

(function(c,l,a,r,i,t,y){
c[a]=c[a]||function(){(c[a].q=c[a].q||[]).push(arguments)};
t=l.createElement(r);t.async=1;t.src="https://www.clarity.ms/tag/"+i;
y=l.getElementsByTagName(r)[0];y.parentNode.insertBefore(t,y);
})(window, document, "clarity", "script","${settings.CLARITY_PROJECT_ID}");

function sendTracking(data) {
const url = "${tracking_api_url}";
requestData = { event_data: data }
Expand Down

0 comments on commit 7a58e05

Please sign in to comment.