Solved

Accessing segment in CMS template

  • 23 November 2020
  • 6 replies
  • 103 views

Badge

Hi there,

Is there a way to e.g. access the segment of a visitor coming from an email in our CMS to personalise content?

Initially I had thought of e.g. adding segment data as url parameters to links in Klaviyo emails, which we can then use in the CMS. Is it possible to access segments as template tokens in email design so visitors to our site arrive at parameterised URLs?

Thanks,

Matt

icon

Best answer by cassy.lee 30 November 2020, 23:16

Hi @Mailing

Thanks for providing some additional context to your CMS. @Paul S and/or other Community members may have a different opinion on this, but if I understand your question correctly, you’re looking to track traffic from email in addition to what segment that user is in? 

If you are trying to track traffic from email, UTMs will work great for this purpose. You can create a UTM parameters for the emails that would only show up in Wagtail.io. If you are looking to transfer a specific segment to your CMS, you can export segment members as a CSV file. It’s worth noting that segments grow/shrink over time, so this may fluctuate.  

To configure your accounts UTM tracking, I recommend reviewing this UTM guide. Additionally, this guide on How to Segment by Acquisition source might also be helpful.

Best, 
-Cass.

View original

6 replies

Userlevel 5
Badge +3

Hi @Mailing, so just to ask some clarifying questions, were you able to get your segments created using the url parameters?

Also out of curiosity, what CMS are you utilizing on your site. It may be possible but any additional information that you could provide would be helpful in this instance. 

Badge

Hi @Paul S ,

I have no segments created yet, this is a theoretical question.

Our CMS is https://wagtail.io which has a segmentation module that allows query-parameter based content design https://wagtail-personalisation.readthedocs.io/en/latest/default_rules.html#query-rule

Thanks.

Badge

Hi there. Anyone have any ideas on this?

@cassy.lee   @Paul S 

Thanks!

Userlevel 6
Badge +5

Hi @Mailing

Thanks for providing some additional context to your CMS. @Paul S and/or other Community members may have a different opinion on this, but if I understand your question correctly, you’re looking to track traffic from email in addition to what segment that user is in? 

If you are trying to track traffic from email, UTMs will work great for this purpose. You can create a UTM parameters for the emails that would only show up in Wagtail.io. If you are looking to transfer a specific segment to your CMS, you can export segment members as a CSV file. It’s worth noting that segments grow/shrink over time, so this may fluctuate.  

To configure your accounts UTM tracking, I recommend reviewing this UTM guide. Additionally, this guide on How to Segment by Acquisition source might also be helpful.

Best, 
-Cass.

Badge

Hi @cassy.lee@Paul S thanks for your answers.

 

I am not hoping to “track traffic from email in addition to what segment that user is in”, I am hoping to access the user’s segment in our CMS as the user comes from an email. So:

  1. User in segment X gets email with link that has a url_parameter with user’s segment.
  2. Following that link takes user to e.g. www.oursite.com/page?segment=regulardonor
  3. CMS personalises content for `regulardonor` segment, higher engagement ensues.

As you say, importing segment members by CSV is one way to do this on some CMS’s, but our CMS doesn’t have user logins/cookies that recognise users by email. Unless you mean we can use the Klaviyo cookie somehow? (Your link on Segment Acquisition doesn’t seem so work, maybe that would explain it). In any case, segment export is laborious and would need to be repeated on segment update, whilst I’m hoping for a simple, dynamic solution.

 

url_params seem easiest to me as we could quickly create a segment, add the param, and make blocks on our site recognise url params.

I tried to do that in Klaviyo like this:

{% if 'UNYp28' in person|lookup:'$lists' %}

<p>Person in segment</p>

{% else %}

<p>Person not in segment</p>

{% endif %}

which is somewhat how we set things up in our preference center Hosted Page i.e. a contact’s lists are available to query in the template. (Related: I am having problem accessing simple custom properties in the template too

{{ person|lookup:'importSent' }}

 which might be the issue – I’m following this:https://www.klaviyo.com/docs/email-tags ).

 

In sum, it’d be great to attach segment data to in-email urls to assist with personalisation. Is this possible?

 

Thanks!

Matt

Badge

To be clear, the code snippet I showed above indicates how I’d query a profile for a segment in a template, not how I‘d subsequently attach the url parameter. This is probably obvious, but...

Reply