Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

basic mixpanel tracking #224

Open
serenamm opened this issue Oct 15, 2022 · 4 comments
Open

basic mixpanel tracking #224

serenamm opened this issue Oct 15, 2022 · 4 comments
Labels

Comments

@serenamm
Copy link

Hi!

Thanks so much for creating this repo. I'm having trouble doing basic mixpanel tracking.

I've set up my template html file to look like this:

{% load analytical %}
{% load mixpanel %}
<!DOCTYPE ... >
<html>
    <head>
        {% analytical_head_top %}

        ...

        {% analytical_head_bottom %}
    {% mixpanel %}
    </head>
    <body>
        {% analytical_body_top %}

        ...

        {% analytical_body_bottom %}
    </body>
</html>

and my settings.py file looks like:

INSTALLED_APPS = [
    ...
    'analytical',
    ...
]

I also added my MIXPANEL_API_TOKEN to settings.py as well, and I have django-analytical==3.1.0 in my requirements.txt file.

I deployed these changes to a test website, so it's in prod, not dev.

I think I must be missing something -- should I be making any other code changes to enable tracking?

Thanks!

@bittner
Copy link
Member

bittner commented Oct 16, 2022

I think you're mixing up the generic setup for Analytical and the specific setup for Mixpanel.

Try to remove the {% mixpanel %} from your code. It should only be necessary if you don't (want to) use the generic setup.

Also, take a look at the generated code in your web browser. You should be able to see the JavaScript code snippet included in the HTML once.

Let us know if that works or if there is actually some issue with the integration!

@serenamm
Copy link
Author

hI @bittner , thanks for your reply. You're right, I was mixing up the generic setupand the specific setup for Mixpanel. I removed the {% mixpanel %} tag and I do now see the JS code snippet show up when I view the source code on my browser.

I know this seems like an extremely simple question so thank you for helping me -- I don't see any events showing up in my Mixpanel dashboard. Should I be making any other code changes to enable tracking? Does django-analytical automatically track all clicks on the website? (I suspect the answer is "no", but I'm asking this as an example).

@bittner
Copy link
Member

bittner commented Oct 18, 2022

I can't answer this question for sure. Usually, our documentation walks you through the complete setup steps, at least on the Django side.

Note that Analytical is really just a template tag library that injects a JavaScript code snippet into your Django templates. All the rest depends on the provider of the analytics service.

It could be that Mixpanel have changed their setup, and that the one that was contributed to Analytical is legacy. But really that's just guessing on my side, based on the fact that I can't find the code snippet we have in their documentation.

If you find out more please post your findings here for everyone to benefit. Thanks!

@jcassee
Copy link
Collaborator

jcassee commented Oct 18, 2022

I know this seems like an extremely simple question so thank you for helping me -- I don't see any events showing up in my Mixpanel dashboard. Should I be making any other code changes to enable tracking? Does django-analytical automatically track all clicks on the website? (I suspect the answer is "no", but I'm asking this as an example).

I can answer that. Because it's not obvious what events are "interesting", django-analytical will not send any events itself. There is some hints about sending events yourself in the documentation, and a very old issue (#10) on doing something generic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants