Friday, August 2, 2024
1 change · saas-17.4
New functionality added to Odoo
This adds a new marketing card feature that lets teams create personalized, shareable links with tailored cover images for partners, presenters, or event participants. It helps encourage word-of-mouth promotion, supports tracking of opens, shares, and clicks, and can optionally guide participants to a reward after sharing.
Original PR description
Word-of-mouth is a great way to get high-quality leads for cheap. This addon allows users to create templates for partners to share a link with their a cover image tailored to them on social media. A…
Word-of-mouth is a great way to get high-quality leads for cheap. This addon allows users to create templates for partners to share a link with their a cover image tailored to them on social media. A good use case is to allow presenters to advertize their track during an event, each of them can advertize their own track and the event in a way that's consistent accross all presenters of the event. This also allows for rewarding partners who do share the event by giving them any link once they share the event, to a coupon for example. ---------------------------------- ### Open Graph To get social networks to render the image, we use opengraph with a redirect url. When a social network bot is detected on the redirection endpoint, the endpoint serves a minimal html page containing only open graph data. When a regular user then clicks the link they'll be redirected normally to a url of our choosing. The list of network bot user agents needs to be kept up to date for this feature to work properly, and the feature will only work for listed social networks. ### Rendering The rendering is in two steps: - ir.qweb to get an html web page - wkhtmltoimage to actually render the image to a jpeg wkhtmltoimage works very similarly to wkhtmltopdf, instanciating a headless webkit engine to render the page. For our purposes the html body should be self-sufficient, meaning wkhtmltopdf may not execute scripts or fetch data. ### Card Campaign A card campaign comprises: - A template, defining the general design/layout of the card in html - Elements, modifiable by the user to either set static or dynamic values - A target model, defining what model the dynamic values are picked from - A preview record, allowing users to preview the card with specific values - A send button, allowing users to send the card by mail using a domain Each campaign tracks cards sent, cards opened, cards shared and how many clicks these cards from social media globally. The campaign elements simply hold values to be passed to ir.qweb at the time of rendering. Either a static value (text/uploaded image), or a field path. The field path is validated based on hard-coded values on each model. Other field paths may only be set by system administrators, as they may pose security concerns. **All paths are fetched as sudo**. Sharing the card by other means than the built-in composer can be done by just calling `_get_preview_url_from_res_id` on a specific card campaign for any automated action and/or mail template. The card will be auto-generated no matter what. Although it is recommended to create it uppon sending for tracking purposes. ### Card Templates Templates define the layout of the card in html as well as some default color and background settings. For the base data the bodies simply call views which makes it easier to reuse CSS classes and qweb variables. ### Cards Cards cache the resulting card image for any recipient so as to prevent compute spamming, as rendering is relatively expensive. For the same reason card URLs are hmac-signed so users cannot generate cards for all recipients at once by just guessing url parameters. One a user has shared the card, they'll get a message on the preview page which can be used for them to get small rewards. The message is the same for every participant, and the "share" detection mechanism is not totally reliable in that it will lead to false positives. Therefore the rewards should not be too consequential. To avoid massive unused data, the cards are cleared of their images every day. And (re-)computed on demand. ---------------------------------- task-3495279