{
    "metadata": {
        "id": "_i6iqbc3x8_sessionPageReferrer",
        "name": "Detect page referrer on page view",
        "description": "Set page referring URL property on session when a page is view",
        "readOnly":true
    },

    "priority": -9,

    "condition": {
        "type": "eventTypeCondition",
        "parameterValues": {
            "eventTypeId": "view"
        }
    },

    "actions": [
        {
            "parameterValues": {
                "setPropertyName": "properties.pageReferringURL",
                "setPropertyValue": "eventProperty::target.properties.pageInfo.referringURL",
                "storeInSession": true
            },
            "type": "setPropertyAction"
        },
        {
            "parameterValues": {
                "setPropertyName": "size",
                "setPropertyValue": "script::session != null ? session.size + 1 : 0",
                "storeInSession": true
            },
            "type": "setPropertyAction"
        }
    ]

}