Marketing campaign


When doing marketing campaign, it is often useful to be able to measure its impact. So it will be great to be able to link together documents created thanks to the campaign.
The common data that are collected are the UTM parameters - Wikipedia.


In a new module marketing_campaign:

We add three models: marketing.campaign, marketing.medium, marketing.source with:

  • name
  • active

with a unique constraint on the name.

We define a mixin with:

  • marketing_campaign: Many2One to marketing.campaign
  • marketing_medium: Many2One to marketing.medium
  • marketing_source: Many2One to marketing.source

they are filled using default value in the context by creating if necessary the record if the name does not already exist.

The model is extended with the mixin (using extra_depends) and the fields are added to the form view for manual encoding.
The sale.reporting.context is also extended to add the three fields as filter and all sale_reporting.Abstract classes are extended to filter by those values.
A new report is added to group by one or more of the three fields.

The sale.opportunity model is also extended with the mixin and the values are passed to the created sales.

The model is also extended with the mixin and the reporting must include the new fields.

The Sale.get_from_shopify is extended to parse the landing_site attribute and find the UTM parameters (as suggested by How to get the UTM parameters associated with the order through rest admin API - Shopify Community).


I think it makes sense to also add the mixin to sale.opportunity.

1 Like

Indeed I think it is better to have a global unique constraint otherwise we will need a way to merge wrongly deactivated parameters with the same name active.

This topic was automatically closed after 8 days. New replies are no longer allowed.