Giter Club home page Giter Club logo

Comments (1)

bittner avatar bittner commented on June 1, 2024

(Sorry that this answer comes late!)

How do you currently set the FACEBOOK_PIXEL_ID in your application configuration? Wouldn't a simple if-then-else in your project settings module do the trick? e.g.

SITE_PIXELS = {
    "one.example.com": "123",
    "two.example.com": "456",
    "three.example.com": "789",
}
FACEBOOK_PIXEL_ID = SITE_PIXELS.get(request.get_host())

Apparently, the trick here is to get access to the request object. If that doesn't prove to be possible as some suggest you may set FACEBOOK_PIXEL_ID dynamically before the template gets processed, e.g. inside of a context processor you write yourself.

It may be worth to document such an approach in our documentation. Not sure if it makes sense to change the implementation of the template tag. If you think it is, I would suggest to try to find a generic approach for all template tags. (That said, PRs welcome!)

from django-analytical.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.