Highlighted

How can I write a load rule to only fire a tag on the Second pageview of a users session?

Rookie Contributor
We're looking to load a survey on our site and don't want to ask the user "how do you like our site?" when they haven't even experienced it, so we're looking to trigger the tag on their second pageview (maybe even later in the experience, but that's just a matter of changing >1, to >2, >3, etc).
5 REPLIES 5
Highlighted

How can I write a load rule to only fire a tag on the Second pageview of a users session?

Employee Emeritus
Hi Jeremy, you can this by combining two extensions. First you need to create a Set Data Values extension, and create a variable called session_count, and set it with a JS Code value that reads: {code:js} (b.session_count || 0) + 1 {code} This says "use the existing value of session_count, or if it doesn't exist yet, start from 0; then add 1". Then use a Persist Values extension to store the session_count value in a cookie, so it will be incremented on the next page view. You should set the load rule on your tag based on the value of the cookie, not the data object variable.
Highlighted

How can I write a load rule to only fire a tag on the Second pageview of a users session?

Rookie Contributor
Thanks! I'll start working on this and let you know how it goes.
Highlighted

How can I write a load rule to only fire a tag on the Second pageview of a users session?

Tealium Employee

Take a look at this Extension: https://community.tealiumiq.com/t5/Tealium-iQ-Tag-Management/SiteCatalyst-Visit-Details-Extension/ta... Stay tuned.. this "page view (event) count" will be something you can grab from the utag_main cookie. Look for this in a utag.js template releasing next month.

Highlighted

How can I write a load rule to only fire a tag on the Second pageview of a users session?

Rookie Contributor
Hi, I have an additional need. After this tag fires, we'd like it to not fire for the next 30 days. This way they user isn't being constantly pestered with a survey.
Highlighted

How can I write a load rule to only fire a tag on the Second pageview of a users session?

Employee Emeritus
You can do this within Tealium but it would probably require a bit of custom code to calculate the end of the suppression period. Your services engineer can help with that.